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, setVolatileLong
assertCloseable, 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, warnAndCloseIfNotClosed
clone, 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.IllegalStateException
- if the object is not in a valid state for the operation.public void bytesStore(@NotNull @NotNull BytesStore bytes, long offset, long length) throws IllegalStateException, IllegalArgumentException, BufferUnderflowException
bytesStore
in interface Byteable
bytes
- the BytesStore
containing the bytes.offset
- the offset at which the long value is stored.length
- the length of the bytes in the BytesStore
.IllegalStateException
- if the object is not in a valid state for the operation.IllegalArgumentException
- if the length does not match the expected size.BufferUnderflowException
- if the operation exceeds the bounds of the buffer.@NotNull public @NotNull BytesStore bytesStore()
Byteable
bytesStore
in interface Byteable
public long offset()
Byteable
public long maxSize()
Byteable
@NotNull public @NotNull String toString()
toString
in class net.openhft.chronicle.core.io.AbstractCloseable
public long getValue() throws IllegalStateException
getValue
in interface net.openhft.chronicle.core.values.LongValue
IllegalStateException
public void setValue(long value) throws IllegalStateException
setValue
in interface net.openhft.chronicle.core.values.LongValue
IllegalStateException
public long getVolatileValue() throws IllegalStateException
getVolatileValue
in interface net.openhft.chronicle.core.values.LongValue
IllegalStateException
public void setVolatileValue(long value) throws IllegalStateException
setVolatileValue
in interface net.openhft.chronicle.core.values.LongValue
IllegalStateException
public long getVolatileValue(long closedValue)
getVolatileValue
in interface net.openhft.chronicle.core.values.LongValue
public void setOrderedValue(long value) throws IllegalStateException
setOrderedValue
in interface net.openhft.chronicle.core.values.LongValue
IllegalStateException
public long addValue(long delta) throws IllegalStateException
addValue
in interface net.openhft.chronicle.core.values.LongValue
IllegalStateException
public long addAtomicValue(long delta) throws IllegalStateException
addAtomicValue
in interface net.openhft.chronicle.core.values.LongValue
IllegalStateException
public boolean compareAndSwapValue(long expected, long value) throws IllegalStateException
compareAndSwapValue
in interface net.openhft.chronicle.core.values.LongValue
IllegalStateException
protected void performClose() throws IllegalStateException
performClose
in class net.openhft.chronicle.core.io.UnsafeCloseable
IllegalStateException
Copyright © 2023. All rights reserved.