|
||||||||||
| 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.AtomicLong
org.exoplatform.commons.utils.AtomicPositiveLong
public class AtomicPositiveLong
Extends the @link{AtomicLong} to contain positive longs. If no initial value is provided when the object is created then the value is -1 to indicate that it is not yet initialized.
| Constructor Summary | |
|---|---|
AtomicPositiveLong()
Create an atomic positive long with no initial value. |
|
AtomicPositiveLong(long initialValue)
Create an atomic positive long with an inital provided value. |
|
| Method Summary | |
|---|---|
void |
setIfGreater(long newValue)
Update the value if the new value is greater than the previous one or if the long is not initialized. |
void |
setIfLower(long newValue)
Update the value if the new value is lower than the previous one or if the long is not initialized. |
| Methods inherited from class java.util.concurrent.atomic.AtomicLong |
|---|
addAndGet, compareAndSet, decrementAndGet, doubleValue, floatValue, get, getAndAdd, getAndDecrement, getAndIncrement, getAndSet, incrementAndGet, intValue, 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 AtomicPositiveLong(long initialValue)
throws java.lang.IllegalArgumentException
initialValue - the initial value
java.lang.IllegalArgumentException - if the value is negativepublic AtomicPositiveLong()
| Method Detail |
|---|
public void setIfGreater(long newValue)
throws java.lang.IllegalArgumentException
newValue - the new value
java.lang.IllegalArgumentException - if the new value is negative
public void setIfLower(long newValue)
throws java.lang.IllegalArgumentException
newValue - the new value
java.lang.IllegalArgumentException - if the new value is negative
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||