public class UncheckedLongReference extends net.openhft.chronicle.core.io.UnsafeCloseable implements LongReference, net.openhft.chronicle.core.io.ReferenceOwner
This class is useful when operating with off-heap memory or memory-mapped file storage, where it is critical to avoid unnecessary bounds checking for performance reasons.
This class extends UnsafeCloseable to provide functionality for safely closing resources.
LongReference,
ReferenceOwner,
UnsafeCloseable,
BytesStore,
BinaryLongReference| Constructor and Description |
|---|
UncheckedLongReference() |
| Modifier and Type | Method and Description |
|---|---|
long |
addAtomicValue(long delta) |
long |
addValue(long delta) |
@NotNull BytesStore |
bytesStore()
Returns the ByteStore to which this object currently points.
|
void |
bytesStore(@NotNull BytesStore bytes,
long offset,
long length)
Stores the bytes of the long value reference.
|
boolean |
compareAndSwapValue(long expected,
long value) |
static @NotNull LongReference |
create(@NotNull BytesStore bytesStore,
long offset,
int size)
Creates an
UncheckedLongReference or BinaryLongReference depending on JVM debug status. |
long |
getValue() |
long |
getVolatileValue() |
long |
getVolatileValue(long closedValue) |
long |
maxSize()
Returns the maximum size in bytes that this reference can point to.
|
long |
offset()
Returns the offset within the ByteStore to which this object currently points.
|
protected void |
performClose() |
void |
setOrderedValue(long value) |
void |
setValue(long value) |
void |
setVolatileValue(long value) |
@NotNull String |
toString() |
addAtomicLong, addLong, address, compareAndSwapLong, getLong, getVolatileLong, getVolatileLong, setLong, setOrderedLong, setVolatileLongassertCloseable, assertCloseablesClosed, clearUsedByThread, close, createdHere, disableCloseableTracing, disableThreadSafetyCheck, disableThreadSafetyCheck, enableCloseableTracing, gcAndWaitForCloseablesToClose, isClosed, isClosing, isInUserThread, referenceId, resetUsedByThread, shouldPerformCloseInBackground, shouldWaitForClosed, singleThreadedCheckDisabled, singleThreadedCheckDisabled, singleThreadedCheckReset, threadSafetyCheck, throwExceptionIfClosed, throwExceptionIfClosedInSetter, unmonitor, waitForCloseablesToClose, waitForClosed, warnAndCloseIfNotClosedclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait@NotNull public static @NotNull LongReference create(@NotNull @NotNull BytesStore bytesStore, long offset, int size) throws IllegalArgumentException, BufferOverflowException, BufferUnderflowException, IllegalStateException
UncheckedLongReference or BinaryLongReference depending on JVM debug status.bytesStore - the BytesStore to be used for storing the long value.offset - the offset at which the long value is stored.size - the size of the long value in bytes.LongReference instance.IllegalArgumentException - If the size does not match the expected size.BufferOverflowException - If the operation exceeds the bounds of the buffer.BufferUnderflowException - If the operation exceeds the bounds of the buffer.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 void bytesStore(@NotNull
@NotNull BytesStore bytes,
long offset,
long length)
throws IllegalStateException,
IllegalArgumentException,
BufferUnderflowException
bytesStore in interface Byteablebytes - the BytesStore containing the bytes.offset - the offset at which the long value is stored.length - the length of the bytes in the BytesStore.IllegalArgumentException - If the length does not match the expected size.BufferUnderflowException - If the operation exceeds the bounds of the buffer.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 wayIllegalStateException@NotNull public @NotNull BytesStore bytesStore()
ByteablebytesStore in interface Byteablepublic long offset()
Byteablepublic long maxSize()
Byteable@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.LongValueIllegalStateExceptionpublic void setValue(long value)
throws IllegalStateException
setValue in interface net.openhft.chronicle.core.values.LongValueIllegalStateExceptionpublic long getVolatileValue()
throws IllegalStateException
getVolatileValue in interface net.openhft.chronicle.core.values.LongValueIllegalStateExceptionpublic void setVolatileValue(long value)
throws IllegalStateException
setVolatileValue in interface net.openhft.chronicle.core.values.LongValueIllegalStateExceptionpublic long getVolatileValue(long closedValue)
getVolatileValue in interface net.openhft.chronicle.core.values.LongValuepublic void setOrderedValue(long value)
throws IllegalStateException
setOrderedValue in interface net.openhft.chronicle.core.values.LongValueIllegalStateExceptionpublic long addValue(long delta)
throws IllegalStateException
addValue in interface net.openhft.chronicle.core.values.LongValueIllegalStateExceptionpublic long addAtomicValue(long delta)
throws IllegalStateException
addAtomicValue in interface net.openhft.chronicle.core.values.LongValueIllegalStateExceptionpublic boolean compareAndSwapValue(long expected,
long value)
throws IllegalStateException
compareAndSwapValue in interface net.openhft.chronicle.core.values.LongValueIllegalStateExceptionprotected void performClose()
throws IllegalStateException
performClose in class net.openhft.chronicle.core.io.UnsafeCloseableIllegalStateExceptionCopyright © 2023. All rights reserved.