Package co.paralleluniverse.fibers
Class SchedulerLocal<T>
- java.lang.Object
-
- co.paralleluniverse.fibers.SchedulerLocal<T>
-
public class SchedulerLocal<T> extends java.lang.Object
Associates a value with the currentFiberScheduler
-
-
Constructor Summary
Constructors Constructor Description SchedulerLocal()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
get()
Returns the scheduler-local value of thisSchedulerLocal
.protected T
initialValue(FiberScheduler scheduler)
Computes the initial value for the currentFiberScheduler
.void
remove()
Removes the association between the scheduler-local value and the current scheduler.void
set(T value)
Sets the scheduler-local value of thisSchedulerLocal
.
-
-
-
Method Detail
-
initialValue
protected T initialValue(FiberScheduler scheduler)
Computes the initial value for the currentFiberScheduler
. Returnsnull
by default;- Parameters:
scheduler
- the currentFiberScheduler
- Returns:
- the initial value
-
get
public final T get() throws SuspendExecution
Returns the scheduler-local value of thisSchedulerLocal
.- Throws:
SuspendExecution
-
set
public final void set(T value)
Sets the scheduler-local value of thisSchedulerLocal
.
-
remove
public final void remove()
Removes the association between the scheduler-local value and the current scheduler. The next call toget()
would return the initial value returned by a fresh call toinitialValue
.
-
-