public final class DynamicVariable extends Object
InheritableThreadLocal| Constructor and Description |
|---|
DynamicVariable(Object init)
Creates a new dynamic variable with an initial value.
|
| Modifier and Type | Method and Description |
|---|---|
String |
toString() |
Object |
value()
Returns the thread-local value of the dynamic variable.
|
DynamicVariable |
value(Object value)
Changes the dynamic variable value.
|
Object |
withValue(Object value,
MethodHandle func)
Given a value, calls a function
func. |
public DynamicVariable(Object init)
init - the initial value.public Object value()
public DynamicVariable value(Object value)
value - the new thread-local value.public Object withValue(Object value, MethodHandle func) throws Throwable
func. The previous value is put pack as the dynamic variable value
once func has completed.value - the value for the course of the execution of func.func - a 0-arity function.func.Throwable - in case an exception occurs.Copyright © 2014 Institut National des Sciences Appliquées de Lyon (INSA-Lyon). All Rights Reserved.