public class MonotonicAtomicLong extends AtomicLong
AtomicLong with methods that allow it to be updated only if
doing so would increase (or decrease) its value.| Constructor and Description |
|---|
MonotonicAtomicLong() |
| Modifier and Type | Method and Description |
|---|---|
long |
decrease(long newValue)
Updates the value of this
AtomicLong if it is smaller than the
current value, and returns the actual new value. |
long |
increase(long newValue)
Updates the value of this
AtomicLong if it is bigger than the
current value, and returns the actual new value. |
accumulateAndGet, addAndGet, compareAndSet, decrementAndGet, doubleValue, floatValue, get, getAndAccumulate, getAndAdd, getAndDecrement, getAndIncrement, getAndSet, getAndUpdate, incrementAndGet, intValue, lazySet, longValue, set, toString, updateAndGet, weakCompareAndSetbyteValue, shortValuepublic long increase(long newValue)
AtomicLong if it is bigger than the
current value, and returns the actual new value.
Implemented this way (without AtomicLong.updateAndGet(java.util.function.LongUnaryOperator)) for compatibility
with java 1.7.newValue - the new value to try to set.newValue.public long decrease(long newValue)
AtomicLong if it is smaller than the
current value, and returns the actual new value.
Implemented this way (without AtomicLong.updateAndGet(java.util.function.LongUnaryOperator)) for compatibility
with java 1.7.newValue - the value to try to set.newValue.Copyright © 2021 jitsi.org. All rights reserved.