Interface AccessMode
-
public interface AccessMode
Defines the access mode of a context local storage.
-
-
Field Summary
Fields Modifier and Type Field Description static AccessMode
CONCURRENT
This access mode provides concurrent access to context local storage with thread safety and atomicity.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Object
get(Object[] locals, int idx)
Return the object at indexidx
in thelocals
array.Object
getOrCreate(Object[] locals, int idx, java.util.function.Supplier<Object> initialValueSupplier)
Get or create the object at indexindex
in thelocals
array.void
put(Object[] locals, int idx, Object value)
Putvalue
in thelocals
array at indexidx
-
-
-
Field Detail
-
CONCURRENT
static final AccessMode CONCURRENT
This access mode provides concurrent access to context local storage with thread safety and atomicity.
-
-
Method Detail
-
get
Object get(Object[] locals, int idx)
Return the object at indexidx
in thelocals
array.- Parameters:
locals
- the arrayidx
- the index- Returns:
- the object at
index
-
put
void put(Object[] locals, int idx, Object value)
Putvalue
in thelocals
array at indexidx
- Parameters:
locals
- the arrayidx
- the indexvalue
- the value
-
getOrCreate
Object getOrCreate(Object[] locals, int idx, java.util.function.Supplier<Object> initialValueSupplier)
Get or create the object at indexindex
in thelocals
array. When the object does not exist,initialValueSupplier
must be called to obtain this value.- Parameters:
locals
- the arrayidx
- the indexinitialValueSupplier
- the supplier of the initial value
-
-