Java 类org.apache.curator.framework.recipes.atomic.DistributedAtomicInteger 实例源码

项目:bd-codes    文件:CuratorCounterTest.java   
/**
 * 测试入口
 */
public static void main(String[] args) throws Exception {
    client.start();

    DistributedAtomicInteger atomicInteger = new DistributedAtomicInteger(
            client, path, new RetryNTimes(3, 1000));

    int jia = new Random().nextInt(100);
    AtomicValue<Integer> rc = atomicInteger.add(jia);
    System.out.println("pre: " + rc.preValue());
    System.out.println("add: " + jia);
    System.out.println("post: " + rc.postValue());
    System.out.println("Result: " + rc.succeeded());
}
项目:urmia    文件:ZkJobStatusUpdaterHandler.java   
public ZkJobStatusUpdaterHandler(CuratorFramework client, String jobId) {

        String path = getGlobalZkPath(jobId);


        inputDone = new DistributedAtomicInteger(client, path + "/stats/inputDone", RETRY_POLICY);
        cancelled = new DistributedAtomicInteger(client, path + "/stats/cancelled", RETRY_POLICY);

        errors = new DistributedAtomicInteger(client, path + "/stats/errors", RETRY_POLICY);
        outputs = new DistributedAtomicInteger(client, path + "/stats/outputs", RETRY_POLICY);
        retries = new DistributedAtomicInteger(client, path + "/stats/retries", RETRY_POLICY);
        tasks = new DistributedAtomicInteger(client, path + "/stats/tasks", RETRY_POLICY);
        tasksDone = new DistributedAtomicInteger(client, path + "/stats/tasksDone", RETRY_POLICY);
    }
项目:Mastering-Mesos    文件:ExecutorIdGenerator.java   
@Override
public void start() {
  this.distributedGenerator = new DistributedAtomicInteger(curator, COUNTER_PATH, new RetryOneTime(1));
}
项目:Singularity    文件:ExecutorIdGenerator.java   
@Override
public void start() {
  this.distributedGenerator = new DistributedAtomicInteger(curator, COUNTER_PATH, new RetryOneTime(1));
}