Package org.apache.curator.framework.recipes.atomic

Examples of org.apache.curator.framework.recipes.atomic.DistributedAtomicInteger.initialize()


    private int adjustAndGet(String userId, Direction direction) {
        RetryPolicy retryPolicy = new BoundedExponentialBackoffRetry(BASE_SLEEP_TIME_MS, MAX_SLEEP_TIME_MS, MAX_RETRIES);
        DistributedAtomicInteger distributedAtomicInteger = new DistributedAtomicInteger(curatorFramework, counterPath(userId), retryPolicy);

        try {
            distributedAtomicInteger.initialize(0); // this will respect an existing value but set uninitialized values to 0
        } catch (Exception e) {
            throw new LumifyException("failed to initialize counter for " + userId);
        }

        try {
View Full Code Here

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.