public class BinaryLongReference extends AbstractReference implements LongReference
The value may temporarily be LONG_NOT_COMPLETE when used as part
of a state machine.
Volatile and ordered methods follow the same guarantees as
AtomicLong.
Dereferencing a null store in toString() is solely
for debugging.
BytesStore,
LongReference| Modifier and Type | Field and Description |
|---|---|
static long |
LONG_NOT_COMPLETE
Sentinel value indicating that a long operation did not complete as expected.
|
bytesStore, offset| Constructor and Description |
|---|
BinaryLongReference() |
| Modifier and Type | Method and Description |
|---|---|
long |
addAtomicValue(long delta)
Adds a delta to the current 64-bit long value atomically and returns the result.
|
long |
addValue(long delta)
Adds a delta to the current 64-bit long value and returns the result.
|
void |
bytesStore(@NotNull BytesStore bytes,
long offset,
long length)
Stores bytes from the given BytesStore into this BinaryLongReference.
|
boolean |
compareAndSwapValue(long expected,
long value)
Atomically sets the 64-bit long value to the given updated value if the current value is
equal to the expected value.
|
long |
getValue()
Performs a plain read of the value from the backing store.
|
long |
getVolatileValue()
Retrieves the 64-bit long value using volatile memory semantics.
|
long |
maxSize()
Returns the maximum size of this reference in bytes (8 bytes for a 64-bit long).
|
void |
setOrderedValue(long value)
Sets the 64-bit long value using ordered or lazy set memory semantics.
|
void |
setValue(long value)
Writes the value to the backing store using plain semantics.
|
void |
setVolatileValue(long value)
Sets the 64-bit long value using volatile memory semantics.
|
@NotNull String |
toString()
Returns a string representation of this BinaryLongReference.
|
acceptNewBytesStore, address, bytesStore, lock, offset, performClose, tryLock, unmonitorassertCloseable, assertCloseablesClosed, close, createdHere, disableCloseableTracing, enableCloseableTracing, gcAndWaitForCloseablesToClose, isClosed, isClosing, isInUserThread, referenceId, shouldPerformCloseInBackground, shouldWaitForClosed, singleThreadedCheckDisabled, singleThreadedCheckDisabled, singleThreadedCheckReset, threadSafetyCheck, throwExceptionIfClosed, throwExceptionIfClosedInSetter, waitForCloseablesToClose, waitForClosed, warnAndCloseIfNotClosedclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclose, getVolatileValue, isClosed, setMaxValue, setMinValueaddress, bytesStore, lock, offset, tryLockpublic static final long LONG_NOT_COMPLETE
public void bytesStore(@NotNull
@NotNull BytesStore bytes,
long offset,
long length)
throws IllegalStateException,
IllegalArgumentException,
BufferOverflowException
bytesStore in interface ByteablebytesStore in class AbstractReferencebytes - The BytesStore from which bytes will be stored.offset - The starting point in bytes from where the value will be stored.length - The number of bytes that should be stored.
If bytes is a HexDumpBytes, the offset is
masked with HexDumpBytes.MASK.IllegalArgumentException - If the length provided is not equal to 8.BufferOverflowException - If the bytes cannot be written.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalStateExceptionpublic long maxSize()
@NotNull public @NotNull String toString()
toString in class net.openhft.chronicle.core.io.AbstractCloseablepublic long getValue()
throws IllegalStateException
getValue in interface net.openhft.chronicle.core.values.LongValuenet.openhft.chronicle.core.io.ClosedIllegalStateException - if the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - if accessed by multiple threads unsafelyIllegalStateExceptionpublic void setValue(long value)
throws IllegalStateException
setValue in interface net.openhft.chronicle.core.values.LongValuevalue - the value to storenet.openhft.chronicle.core.io.ClosedIllegalStateException - if the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - if accessed by multiple threads unsafelyIllegalStateExceptionpublic long getVolatileValue()
throws IllegalStateException
getVolatileValue in interface net.openhft.chronicle.core.values.LongValuenet.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalStateExceptionpublic void setVolatileValue(long value)
throws IllegalStateException
setVolatileValue in interface net.openhft.chronicle.core.values.LongValuevalue - the 64-bit long value to setnet.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalStateExceptionpublic void setOrderedValue(long value)
throws IllegalStateException
setOrderedValue in interface net.openhft.chronicle.core.values.LongValuevalue - the 64-bit long value to setnet.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalStateExceptionpublic long addValue(long delta)
throws IllegalStateException
addValue in interface net.openhft.chronicle.core.values.LongValuedelta - the value to addnet.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalStateExceptionpublic long addAtomicValue(long delta)
throws IllegalStateException
addAtomicValue in interface net.openhft.chronicle.core.values.LongValuedelta - the value to addnet.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalStateExceptionpublic boolean compareAndSwapValue(long expected,
long value)
throws IllegalStateException
compareAndSwapValue in interface net.openhft.chronicle.core.values.LongValueexpected - the expected 64-bit long valuevalue - the new 64-bit long valuenet.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalStateExceptionCopyright © 2026 Chronicle Software Ltd. All rights reserved.