public class AtomicPositiveLong extends AtomicLong
| Constructor and Description |
|---|
AtomicPositiveLong()
Create an atomic positive long with no initial value.
|
AtomicPositiveLong(long initialValue)
Create an atomic positive long with an inital provided value.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
addAndGet, compareAndSet, decrementAndGet, doubleValue, floatValue, get, getAndAdd, getAndDecrement, getAndIncrement, getAndSet, incrementAndGet, intValue, lazySet, longValue, set, toString, weakCompareAndSetbyteValue, shortValuepublic AtomicPositiveLong(long initialValue)
throws IllegalArgumentException
initialValue - the initial valueIllegalArgumentException - if the value is negativepublic AtomicPositiveLong()
public void setIfGreater(long newValue)
throws IllegalArgumentException
newValue - the new valueIllegalArgumentException - if the new value is negativepublic void setIfLower(long newValue)
throws IllegalArgumentException
newValue - the new valueIllegalArgumentException - if the new value is negativeCopyright © 2025 JBoss by Red Hat. All Rights Reserved.