Interface AccessMode
-
public interface AccessModeDefines the access mode of a context local storage.
-
-
Field Summary
Fields Modifier and Type Field Description static AccessModeCONCURRENTThis 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 Objectget(Object[] locals, int idx)Return the object at indexidxin thelocalsarray.ObjectgetOrCreate(Object[] locals, int idx, Supplier<Object> initialValueSupplier)Get or create the object at indexindexin thelocalsarray.voidput(Object[] locals, int idx, Object value)Putvaluein thelocalsarray 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 indexidxin thelocalsarray.- Parameters:
locals- the arrayidx- the index- Returns:
- the object at
index
-
put
void put(Object[] locals, int idx, Object value)
Putvaluein thelocalsarray at indexidx- Parameters:
locals- the arrayidx- the indexvalue- the value
-
getOrCreate
Object getOrCreate(Object[] locals, int idx, Supplier<Object> initialValueSupplier)
Get or create the object at indexindexin thelocalsarray. When the object does not exist,initialValueSuppliermust be called to obtain this value.- Parameters:
locals- the arrayidx- the indexinitialValueSupplier- the supplier of the initial value
-
-