コード例 #1
0
 /**
  * Gets the current value.
  *
  * @return the current value
  */
 public long get() {
   return operations.get(key);
 }
コード例 #2
0
 /**
  * Atomically adds the given value to the current value.
  *
  * @param delta the value to add
  * @return the updated value
  */
 public long addAndGet(long delta) {
   return operations.increment(key, delta);
 }
コード例 #3
0
 /**
  * Atomically sets to the given value and returns the old value.
  *
  * @param newValue the new value
  * @return the previous value
  */
 public long getAndSet(long newValue) {
   return operations.getAndSet(key, newValue);
 }
コード例 #4
0
 /**
  * Atomically decrements by one the current value.
  *
  * @return the updated value
  */
 public long decrementAndGet() {
   return operations.increment(key, -1);
 }
コード例 #5
0
 /**
  * Sets to the given value.
  *
  * @param newValue the new value
  */
 public void set(long newValue) {
   operations.set(key, newValue);
 }