|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Number
java.util.concurrent.atomic.AtomicInteger
com.atlassian.util.concurrent.atomic.AtomicInteger
public class AtomicInteger
AtomicInteger with richer functionality.
This class implements commonly implemented patterns of use of compareAndSet
such as getOrSetAndGetIf(int, int) and update(Function).
| Constructor Summary | |
|---|---|
AtomicInteger()
Creates a new AtomicInteger with a zero initial value. |
|
AtomicInteger(int initialValue)
Creates a new AtomicInteger with the given initial value. |
|
| Method Summary | |
|---|---|
int |
getOrSetAndGetIf(int oldValue,
int newValue)
Check the current value and if it matches the old value argument, set it to the new value and return that instead. |
int |
update(com.google.common.base.Function<java.lang.Integer,java.lang.Integer> newValueFactory)
Do the actual update. |
| Methods inherited from class java.util.concurrent.atomic.AtomicInteger |
|---|
addAndGet, compareAndSet, decrementAndGet, doubleValue, floatValue, get, getAndAdd, getAndDecrement, getAndIncrement, getAndSet, incrementAndGet, intValue, lazySet, longValue, set, toString, weakCompareAndSet |
| Methods inherited from class java.lang.Number |
|---|
byteValue, shortValue |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AtomicInteger()
public AtomicInteger(int initialValue)
initialValue - the initial value| Method Detail |
|---|
public final int getOrSetAndGetIf(int oldValue,
int newValue)
oldValue - to check the current value against.newValue - the new value to set it to.
public final int update(com.google.common.base.Function<java.lang.Integer,java.lang.Integer> newValueFactory)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||