public interface MutableLong extends AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
default boolean |
compareAndSet(long expectedValue,
long newValue)
This is not meant to be atomic; it's semantically equivalent to:
|
long |
get() |
String |
getMutableLongId() |
void |
set(long value) |
String getMutableLongId()
long get() throws UnavailableStateException
UnavailableStateExceptionvoid set(long value) throws UnavailableStateException
UnavailableStateExceptiondefault boolean compareAndSet(long expectedValue,
long newValue)
throws UnavailableStateException
long oldValue = mutableLong.get();
if (mutableLong.oldValue != expectedValue) {
return false;
}
mutableLong.set(newValue);
return true;
UnavailableStateExceptionvoid close()
close in interface AutoCloseableCopyright © 2021 The Apache Software Foundation. All rights reserved.