public class AtomicBiInteger
extends java.util.concurrent.atomic.AtomicLong
Constructor and Description |
---|
AtomicBiInteger() |
Modifier and Type | Method and Description |
---|---|
boolean |
compareAndSet(int expectHi,
int hi,
int expectLo,
int lo)
Atomically sets the values to the given updated values
only if the current encoded value
== the expected value. |
boolean |
compareAndSet(long expect,
int hi,
int lo)
Atomically sets the values to the given updated values
only if the current encoded value
== the expected value. |
boolean |
compareAndSetHi(int expect,
int hi)
Atomically sets the hi int value to the given updated value
only if the current value
== the expected value. |
boolean |
compareAndSetLo(int expect,
int lo)
Atomically sets the lo int value to the given updated value
only if the current value
== the expected value. |
static long |
encode(int hi,
int lo)
Encode hi and lo int values into a long
|
static long |
encodeHi(long encoded,
int hi)
Encode hi int values into an already encoded long
|
static long |
encodeLo(long encoded,
int lo)
Encode lo int values into an already encoded long
|
int |
getHi() |
static int |
getHi(long encoded)
Get a hi int value from an encoded long
|
int |
getLo() |
static int |
getLo(long encoded)
Get a lo int value from an encoded long
|
void |
set(int hi,
int lo)
Set the hi and lo integer values.
|
int |
setHi(int hi)
Atomically set the hi integer value without changing
the lo value.
|
int |
setLo(int lo)
Atomically set the lo integer value without changing
the hi value.
|
void |
update(int deltaHi,
int deltaLo)
Atomically updates the current values with the results of
applying the given deltas.
|
int |
updateHi(int delta)
Atomically updates the current hi value with the results of
applying the given delta, returning the updated value.
|
int |
updateLo(int delta)
Atomically updates the current lo value with the results of
applying the given delta, returning the updated value.
|
accumulateAndGet, addAndGet, compareAndSet, decrementAndGet, doubleValue, floatValue, get, getAndAccumulate, getAndAdd, getAndDecrement, getAndIncrement, getAndSet, getAndUpdate, incrementAndGet, intValue, lazySet, longValue, set, toString, updateAndGet, weakCompareAndSet
public int getHi()
public int getLo()
public int setHi(int hi)
hi
- the new hi valuepublic int setLo(int lo)
lo
- the new lo valuepublic void set(int hi, int lo)
hi
- the new hi valuelo
- the new lo valuepublic boolean compareAndSetHi(int expect, int hi)
==
the expected value.
Concurrent changes to the lo value result in a retry.expect
- the expected valuehi
- the new valuetrue
if successful. False return indicates that
the actual value was not equal to the expected value.public boolean compareAndSetLo(int expect, int lo)
==
the expected value.
Concurrent changes to the hi value result in a retry.expect
- the expected valuelo
- the new valuetrue
if successful. False return indicates that
the actual value was not equal to the expected value.public boolean compareAndSet(long expect, int hi, int lo)
==
the expected value.expect
- the expected encoded valueshi
- the new hi valuelo
- the new lo valuetrue
if successful. False return indicates that
the actual value was not equal to the expected value.public boolean compareAndSet(int expectHi, int hi, int expectLo, int lo)
==
the expected value.expectHi
- the expected hi valueshi
- the new hi valueexpectLo
- the expected lo valueslo
- the new lo valuetrue
if successful. False return indicates that
the actual value was not equal to the expected value.public int updateHi(int delta)
delta
- the delta to applypublic int updateLo(int delta)
delta
- the delta to applypublic void update(int deltaHi, int deltaLo)
deltaHi
- the delta to apply to the hi valuedeltaLo
- the delta to apply to the lo valuepublic static int getHi(long encoded)
encoded
- the encoded valuepublic static int getLo(long encoded)
encoded
- the encoded valuepublic static long encode(int hi, int lo)
hi
- the hi int valuelo
- the lo int valuepublic static long encodeHi(long encoded, int hi)
encoded
- the encoded valuehi
- the hi int valuepublic static long encodeLo(long encoded, int lo)
encoded
- the encoded valuelo
- the lo int value