| 限定符和类型 | 字段和说明 |
|---|---|
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()
Counterpublic void set(long new_value)
Counterpublic boolean compareAndSet(long expect,
long update)
CountercompareAndSet 在接口中 Counterexpect - The expected value of the counterupdate - The new value of the counterpublic long incrementAndGet()
CounterincrementAndGet 在接口中 Counterpublic long decrementAndGet()
CounterdecrementAndGet 在接口中 Counterpublic long addAndGet(long delta)
Counterpublic java.lang.String toString()
toString 在类中 java.lang.Object