Package com.bazaarvoice.ostrich.examples.calculator.service

Source Code of com.bazaarvoice.ostrich.examples.calculator.service.ZooKeeperConfiguration$Retry

package com.bazaarvoice.ostrich.examples.calculator.service;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.netflix.curator.RetryPolicy;
import com.netflix.curator.retry.BoundedExponentialBackoffRetry;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.NotNull;

public class ZooKeeperConfiguration {
    @NotNull
    @NotEmpty
    @JsonProperty("connect-string")
    private final String _connectString = "localhost:2181";

    @JsonProperty("namespace")
    private final String _namespace = null;

    @NotNull
    @JsonProperty("retry")
    private Retry _retry = null;

    public String getConnectString() {
        return _connectString;
    }

    public String getNamespace() {
        return _namespace;
    }

    public RetryPolicy getRetry() {
        return new BoundedExponentialBackoffRetry(_retry.baseSleepTimeMs, _retry.maxSleepTimeMs, _retry.maxAttempts);
    }

    private static final class Retry {
        @NotEmpty
        @NotNull
        @JsonProperty
        private final Integer baseSleepTimeMs = null;

        @NotEmpty
        @NotNull
        @JsonProperty
        private final Integer maxSleepTimeMs = null;

        @NotEmpty
        @NotNull
        @JsonProperty
        private final Integer maxAttempts = null;
    }
}
TOP

Related Classes of com.bazaarvoice.ostrich.examples.calculator.service.ZooKeeperConfiguration$Retry

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.