限定符和类型 | 字段和说明 |
---|---|
protected java.lang.String |
name |
限定符 | 构造器和说明 |
---|---|
protected |
COUNTER.CounterImpl(java.lang.String name) |
限定符和类型 | 方法和说明 |
---|---|
long |
addAndGet(long delta)
Atomically adds the given value to the current value.
|
boolean |
compareAndSet(long expect,
long update)
Atomically updates the counter using a CAS operation
|
long |
decrementAndGet()
Atomically decrements the counter and returns the new value
|
long |
get()
Gets the current value of the counter
|
java.lang.String |
getName() |
long |
incrementAndGet()
Atomically increments the counter and returns the new value
|
void |
set(long new_value)
Sets the counter to a new value
|
java.lang.String |
toString() |
public long get()
Counter
public void set(long new_value)
Counter
public boolean compareAndSet(long expect, long update)
Counter
compareAndSet
在接口中 Counter
expect
- The expected value of the counterupdate
- The new value of the counterpublic long incrementAndGet()
Counter
incrementAndGet
在接口中 Counter
public long decrementAndGet()
Counter
decrementAndGet
在接口中 Counter
public long addAndGet(long delta)
Counter
public java.lang.String toString()
toString
在类中 java.lang.Object