public interface IntValue extends Closeable
The interface provides basic operations such as getting and setting the value, as well as atomic and ordered operations that incorporate memory barriers and atomicity guarantees.
BooleanValue,
ByteValue,
CharValue,
DoubleValue,
FloatValue,
IntValue,
LongValue,
ShortValue,
StringValue,
LongArrayValues,
IntArrayValues| Modifier and Type | Method and Description |
|---|---|
int |
addAtomicValue(int delta)
Atomically adds a specified delta to the current value and returns the result.
|
int |
addValue(int delta)
Atomically adds a specified delta to the current value and returns the result.
|
default void |
close()
Closes this resource, releasing any system resources associated with it.
|
boolean |
compareAndSwapValue(int expected,
int value)
Atomically sets the value to the given updated value if the current value
is equal to the expected value.
|
int |
getValue()
Retrieves the current 32-bit integer value.
|
int |
getVolatileValue()
Retrieves the current 32-bit integer value using volatile semantics,
which include a memory barrier ensuring that subsequent reads and writes
are not reordered beyond this point.
|
default boolean |
isClosed()
Checks if this object is closed.
|
void |
setOrderedValue(int value)
Sets the 32-bit integer value using ordered semantics, which includes
a memory barrier ensuring that previous writes are not reordered beyond
this point.
|
void |
setValue(int value)
Sets the 32-bit integer value.
|
closeQuietly, closeQuietlyisClosingint getValue()
throws IllegalStateException,
BufferUnderflowException
BufferUnderflowException - If there's not enough data available to readClosedIllegalStateException - If the resource has been released or closed.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalStateExceptionvoid setValue(int value)
throws IllegalStateException,
BufferOverflowException
value - the new value to setClosedIllegalStateException - If the resource has been released or closed.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayBufferOverflowException - If there's not enough space to write the dataIllegalStateExceptionint getVolatileValue()
throws IllegalStateException,
BufferUnderflowException
ClosedIllegalStateException - If the resource has been released or closed.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayBufferUnderflowException - If there's not enough data available to readIllegalStateExceptionvoid setOrderedValue(int value)
throws IllegalStateException,
BufferOverflowException
value - the new value to setClosedIllegalStateException - If the resource has been released or closed.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayBufferOverflowException - If there's not enough space to write the dataIllegalStateExceptionint addValue(int delta)
throws IllegalStateException,
BufferUnderflowException
delta - the value to add to the current valueClosedIllegalStateException - If the resource has been released or closed.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayBufferUnderflowException - If there's not enough data available to readIllegalStateExceptionint addAtomicValue(int delta)
throws IllegalStateException,
BufferUnderflowException
delta - the value to add to the current valueClosedIllegalStateException - If the resource has been released or closed.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayBufferUnderflowException - If there's not enough data available to readIllegalStateExceptionboolean compareAndSwapValue(int expected,
int value)
throws IllegalStateException,
BufferOverflowException
expected - the value expected to be presentvalue - the new value to set if the expected value is foundClosedIllegalStateException - If the resource has been released or closed.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayBufferOverflowException - If there's not enough space to write the dataIllegalStateExceptiondefault boolean isClosed()
QueryCloseableisClosed in interface QueryCloseableclose() method has completed, false otherwisedefault void close()
Closeable
Subclasses should override AbstractCloseable.performClose() to provide
the actual close logic.
close in interface AutoCloseableclose in interface CloseableAbstractCloseable.performClose()Copyright © 2024. All rights reserved.