@Deprecated public class UnsetLongValue extends Object implements LongValue
This class is useful in scenarios where a LongValue is expected, but modifications should be ignored, and a fixed or default value should be returned. This is akin to making the value 'immutable'.
The value returned by this class is set at construction and cannot be changed thereafter.
| Constructor and Description |
|---|
UnsetLongValue(long value)
Deprecated.
Constructs an UnsetLongValue with the specified value.
|
| Modifier and Type | Method and Description |
|---|---|
long |
addValue(long delta)
Deprecated.
Ignores the addition and simply returns the value set at construction.
|
boolean |
compareAndSwapValue(long expected,
long value)
Deprecated.
Ignores the compare and swap, and simply returns true.
|
long |
getValue()
Deprecated.
Retrieves the value set at construction.
|
long |
getVolatileValue(long closedValue)
Deprecated.
Retrieves the volatile value provided as a parameter since internal value modification is ignored.
|
void |
setValue(long value)
Deprecated.
This method does not change the value.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddAtomicValue, close, getVolatileValue, isClosed, setMaxValue, setMinValue, setOrderedValue, setVolatileValuecloseQuietly, closeQuietlyisClosingpublic UnsetLongValue(long value)
value - the value to be setpublic long getValue()
throws IllegalStateException
getValue in interface LongValueClosedIllegalStateException - If the resource has been released or closed.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalStateExceptionpublic void setValue(long value)
throws IllegalStateException
setValue in interface LongValuevalue - the value to set (ignored)ClosedIllegalStateException - If the resource has been released or closed.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalStateExceptionpublic long getVolatileValue(long closedValue)
throws IllegalStateException
getVolatileValue in interface LongValueclosedValue - the volatile value to be retrievedClosedIllegalStateException - If the resource has been released or closed.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalStateExceptionpublic long addValue(long delta)
throws IllegalStateException
addValue in interface LongValuedelta - the value to be added (ignored)ClosedIllegalStateException - If the resource has been released or closed.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalStateExceptionpublic boolean compareAndSwapValue(long expected,
long value)
throws IllegalStateException
compareAndSwapValue in interface LongValueexpected - the expected value (ignored)value - the new value (ignored)ClosedIllegalStateException - If the resource has been released or closed.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalStateExceptionCopyright © 2023. All rights reserved.