Java 类org.apache.curator.framework.recipes.shared.VersionedValue 实例源码

项目:flink    文件:ZooKeeperCheckpointIDCounter.java   
@Override
public long getAndIncrement() throws Exception {
    while (true) {
        ConnectionState connState = connStateListener.getLastState();

        if (connState != null) {
            throw new IllegalStateException("Connection state: " + connState);
        }

        VersionedValue<Integer> current = sharedCount.getVersionedValue();
        int newCount = current.getValue() + 1;

        if (newCount < 0) {
            // overflow and wrap around
            throw new Exception("Checkpoint counter overflow. ZooKeeper checkpoint counter only supports " +
                    "checkpoints Ids up to " + Integer.MAX_VALUE);
        }

        if (sharedCount.trySetCount(current, newCount)) {
            return current.getValue();
        }
    }
}
项目:hadoop-oss    文件:ZKDelegationTokenSecretManager.java   
private void incrSharedCount(SharedCount sharedCount) throws Exception {
  while (true) {
    // Loop until we successfully increment the counter
    VersionedValue<Integer> versionedValue = sharedCount.getVersionedValue();
    if (sharedCount.trySetCount(versionedValue, versionedValue.getValue() + 1)) {
      break;
    }
  }
}
项目:hadoop    文件:ZKDelegationTokenSecretManager.java   
private void incrSharedCount(SharedCount sharedCount) throws Exception {
  while (true) {
    // Loop until we successfully increment the counter
    VersionedValue<Integer> versionedValue = sharedCount.getVersionedValue();
    if (sharedCount.trySetCount(versionedValue, versionedValue.getValue() + 1)) {
      break;
    }
  }
}
项目:aliyun-oss-hadoop-fs    文件:ZKDelegationTokenSecretManager.java   
private void incrSharedCount(SharedCount sharedCount) throws Exception {
  while (true) {
    // Loop until we successfully increment the counter
    VersionedValue<Integer> versionedValue = sharedCount.getVersionedValue();
    if (sharedCount.trySetCount(versionedValue, versionedValue.getValue() + 1)) {
      break;
    }
  }
}
项目:big-c    文件:ZKDelegationTokenSecretManager.java   
private void incrSharedCount(SharedCount sharedCount) throws Exception {
  while (true) {
    // Loop until we successfully increment the counter
    VersionedValue<Integer> versionedValue = sharedCount.getVersionedValue();
    if (sharedCount.trySetCount(versionedValue, versionedValue.getValue() + 1)) {
      break;
    }
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ZKDelegationTokenSecretManager.java   
private void incrSharedCount(SharedCount sharedCount) throws Exception {
  while (true) {
    // Loop until we successfully increment the counter
    VersionedValue<Integer> versionedValue = sharedCount.getVersionedValue();
    if (sharedCount.trySetCount(versionedValue, versionedValue.getValue() + 1)) {
      break;
    }
  }
}
项目:hops    文件:ZKDelegationTokenSecretManager.java   
private void incrSharedCount(SharedCount sharedCount) throws Exception {
  while (true) {
    // Loop until we successfully increment the counter
    VersionedValue<Integer> versionedValue = sharedCount.getVersionedValue();
    if (sharedCount.trySetCount(versionedValue, versionedValue.getValue() + 1)) {
      break;
    }
  }
}
项目:flink    文件:ZooKeeperVersionedValue.java   
public ZooKeeperVersionedValue(VersionedValue<T> versionedValue) {
    this.versionedValue = Preconditions.checkNotNull(versionedValue);
}
项目:flink    文件:ZooKeeperVersionedValue.java   
VersionedValue<T> getVersionedValue() {
    return versionedValue;
}