public class HystrixLifecycleForwardingRequestVariable<T> extends HystrixRequestVariableDefault<T>
HystrixRequestVariable
which forwards to the wrapped
HystrixRequestVariableLifecycle
.
This implementation also returns null when get()
is called while the HystrixRequestContext
has not
been initialized rather than throwing an exception, allowing for use in a HystrixConcurrencyStrategy
which
does not depend on an a HystrixRequestContext
Constructor and Description |
---|
HystrixLifecycleForwardingRequestVariable(HystrixRequestVariableLifecycle<T> lifecycle)
Creates a HystrixRequestVariable which will return data as provided by the
HystrixRequestVariableLifecycle |
Modifier and Type | Method and Description |
---|---|
T |
get()
Return null if the
HystrixRequestContext has not been initialized for the current thread. |
T |
initialValue()
Delegates to the wrapped
HystrixRequestVariableLifecycle |
void |
shutdown(T value)
Delegates to the wrapped
HystrixRequestVariableLifecycle |
remove, set
public HystrixLifecycleForwardingRequestVariable(HystrixRequestVariableLifecycle<T> lifecycle)
HystrixRequestVariableLifecycle
lifecycle
- lifecycle used to provide values. Must have the same type parameter as the constructed instance.public T initialValue()
HystrixRequestVariableLifecycle
initialValue
in interface HystrixRequestVariableLifecycle<T>
initialValue
in class HystrixRequestVariableDefault<T>
public void shutdown(T value)
HystrixRequestVariableLifecycle
shutdown
in interface HystrixRequestVariableLifecycle<T>
shutdown
in class HystrixRequestVariableDefault<T>
value
- of request variable to allow cleanup activity.
If nothing needs to be cleaned up then nothing needs to be done in this method.
public T get()
HystrixRequestContext
has not been initialized for the current thread.
If HystrixRequestContext
has been initialized then call method in superclass:
HystrixRequestVariableDefault.get()
get
in interface HystrixRequestVariable<T>
get
in class HystrixRequestVariableDefault<T>