Top Description Constructors Methods
org.eclipse.jetty.util

public Class AtomicBiInteger

extends AtomicLong
Class Inheritance
Imports
java.util.concurrent.atomic.AtomicLong

An AtomicLong with additional methods to treat it as two hi/lo integers.

Constructor Summary

AccessConstructor and Description
public
public
AtomicBiInteger(long encoded)

public
AtomicBiInteger(int hi, int lo)

Method Summary

Modifier and TypeMethod and Description
public void
add(int
the delta to apply to the hi value
deltaHi
,
int
the delta to apply to the lo value
deltaLo
)

Atomically adds the given deltas to the current hi and lo values.

public int

Returns:

the updated hi value
addAndGetHi
(int
the delta to apply
delta
)

Atomically adds the given delta to the current hi value, returning the updated hi value.

public int

Returns:

the updated lo value
addAndGetLo
(int
the delta to apply
delta
)

Atomically adds the given delta to the current lo value, returning the updated lo value.

public boolean

Returns:

true if successful. False return indicates that the actual encoded value was not equal to the expected encoded value.
compareAndSet
(long
the expected encoded value
encoded
,
int
the new hi value
hi
,
int
the new lo value
lo
)

Atomically sets the values to the given updated values only if the current encoded value == the expected encoded value.

public boolean

Returns:

true if successful. False return indicates that the actual hi and lo values were not equal to the expected hi and lo value.
compareAndSet
(int
the expected hi value
expectHi
,
int
the new hi value
hi
,
int
the expected lo value
expectLo
,
int
the new lo value
lo
)

Atomically sets the hi and lo values to the given updated values only if the current hi and lo values == the expected hi and lo values.

public boolean

Returns:

true if successful. False return indicates that the actual hi value was not equal to the expected hi value.
compareAndSetHi
(int
the expected hi value
expectHi
,
int
the new hi value
hi
)

Atomically sets the hi value to the given updated value only if the current value == the expected value.

public boolean

Returns:

true if successful. False return indicates that the actual lo value was not equal to the expected lo value.
compareAndSetLo
(int
the expected lo value
expectLo
,
int
the new lo value
lo
)

Atomically sets the lo value to the given updated value only if the current value == the expected value.

public static long

Returns:

the encoded value
encode
(int
the hi value
hi
,
int
the lo value
lo
)

Encodes hi and lo values into a long.

public static long

Returns:

the new encoded value
encodeHi
(long
the encoded value
encoded
,
int
the hi value
hi
)

Sets the hi value into the given encoded value.

public static long

Returns:

the new encoded value
encodeLo
(long
the encoded value
encoded
,
int
the lo value
lo
)

Sets the lo value into the given encoded value.

public int

Returns:

the previous hi value
getAndSetHi
(int
the new hi value
hi
)

Atomically sets the hi value without changing the lo value.

public int

Returns:

the previous lo value
getAndSetLo
(int
the new lo value
lo
)

Atomically sets the lo value without changing the hi value.

public int

Returns:

the hi value
getHi
()

Get the hi value.

public static int

Returns:

the hi value
getHi
(long
the encoded value
encoded
)

Gets a hi value from the given encoded value.

public int

Returns:

the lo value
getLo
()

Get the lo value.

public static int

Returns:

the lo value
getLo
(long
the encoded value
encoded
)

Gets a lo value from the given encoded value.

public void
set(int
the new hi value
hi
,
int
the new lo value
lo
)

Sets the hi and lo values.

public String
toString()

Overrides java.util.concurrent.atomic.AtomicLong.toString.

Returns the String representation of the current value.

Inherited from java.util.concurrent.atomic.AtomicLong:
accumulateAndGetaddAndGetcompareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetdecrementAndGetdoubleValuefloatValuegetgetAcquiregetAndAccumulategetAndAddgetAndDecrementgetAndIncrementgetAndSetgetAndUpdategetOpaquegetPlainincrementAndGetintValuelazySetlongValuesetsetOpaquesetPlainsetReleaseupdateAndGetweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Constructor Detail

AtomicBiIntegerback to summary
public AtomicBiInteger()
AtomicBiIntegerback to summary
public AtomicBiInteger(long encoded)
AtomicBiIntegerback to summary
public AtomicBiInteger(int hi, int lo)

Method Detail

addback to summary
public void add(int deltaHi, int deltaLo)

Atomically adds the given deltas to the current hi and lo values.

Parameters
deltaHi:int

the delta to apply to the hi value

deltaLo:int

the delta to apply to the lo value

addAndGetHiback to summary
public int addAndGetHi(int delta)

Atomically adds the given delta to the current hi value, returning the updated hi value.

Parameters
delta:int

the delta to apply

Returns:int

the updated hi value

addAndGetLoback to summary
public int addAndGetLo(int delta)

Atomically adds the given delta to the current lo value, returning the updated lo value.

Parameters
delta:int

the delta to apply

Returns:int

the updated lo value

compareAndSetback to summary
public boolean compareAndSet(long encoded, int hi, int lo)

Atomically sets the values to the given updated values only if the current encoded value == the expected encoded value.

Parameters
encoded:long

the expected encoded value

hi:int

the new hi value

lo:int

the new lo value

Returns:boolean

true if successful. False return indicates that the actual encoded value was not equal to the expected encoded value.

compareAndSetback to summary
public boolean compareAndSet(int expectHi, int hi, int expectLo, int lo)

Atomically sets the hi and lo values to the given updated values only if the current hi and lo values == the expected hi and lo values.

Parameters
expectHi:int

the expected hi value

hi:int

the new hi value

expectLo:int

the expected lo value

lo:int

the new lo value

Returns:boolean

true if successful. False return indicates that the actual hi and lo values were not equal to the expected hi and lo value.

compareAndSetHiback to summary
public boolean compareAndSetHi(int expectHi, int hi)

Atomically sets the hi value to the given updated value only if the current value == the expected value.

Concurrent changes to the lo value result in a retry.

Parameters
expectHi:int

the expected hi value

hi:int

the new hi value

Returns:boolean

true if successful. False return indicates that the actual hi value was not equal to the expected hi value.

compareAndSetLoback to summary
public boolean compareAndSetLo(int expectLo, int lo)

Atomically sets the lo value to the given updated value only if the current value == the expected value.

Concurrent changes to the hi value result in a retry.

Parameters
expectLo:int

the expected lo value

lo:int

the new lo value

Returns:boolean

true if successful. False return indicates that the actual lo value was not equal to the expected lo value.

encodeback to summary
public static long encode(int hi, int lo)

Encodes hi and lo values into a long.

Parameters
hi:int

the hi value

lo:int

the lo value

Returns:long

the encoded value

encodeHiback to summary
public static long encodeHi(long encoded, int hi)

Sets the hi value into the given encoded value.

Parameters
encoded:long

the encoded value

hi:int

the hi value

Returns:long

the new encoded value

encodeLoback to summary
public static long encodeLo(long encoded, int lo)

Sets the lo value into the given encoded value.

Parameters
encoded:long

the encoded value

lo:int

the lo value

Returns:long

the new encoded value

getAndSetHiback to summary
public int getAndSetHi(int hi)

Atomically sets the hi value without changing the lo value.

Parameters
hi:int

the new hi value

Returns:int

the previous hi value

getAndSetLoback to summary
public int getAndSetLo(int lo)

Atomically sets the lo value without changing the hi value.

Parameters
lo:int

the new lo value

Returns:int

the previous lo value

getHiback to summary
public int getHi()

Get the hi value.

Returns:int

the hi value

getHiback to summary
public static int getHi(long encoded)

Gets a hi value from the given encoded value.

Parameters
encoded:long

the encoded value

Returns:int

the hi value

getLoback to summary
public int getLo()

Get the lo value.

Returns:int

the lo value

getLoback to summary
public static int getLo(long encoded)

Gets a lo value from the given encoded value.

Parameters
encoded:long

the encoded value

Returns:int

the lo value

setback to summary
public void set(int hi, int lo)

Sets the hi and lo values.

Parameters
hi:int

the new hi value

lo:int

the new lo value

toStringback to summary
public String toString()

Overrides java.util.concurrent.atomic.AtomicLong.toString.

Doc from java.util.concurrent.atomic.AtomicLong.toString.

Returns the String representation of the current value.

Returns:String

the String representation of the current value

Annotations
@Override