Hystrix: Latency and Fault Tolerance for Distributed Systems



com.netflix.hystrix.strategy.concurrency
Interface HystrixRequestVariableLifecycle<T>

Type Parameters:
T -
All Known Subinterfaces:
HystrixRequestVariable<T>

public interface HystrixRequestVariableLifecycle<T>

Interface for lifecycle methods that are then executed by an implementation of HystrixRequestVariable.


Method Summary
 T initialValue()
          Invoked when HystrixRequestVariable.get() is first called.
 void shutdown(T value)
          Invoked when request scope is shutdown to allow for cleanup.
 

Method Detail

initialValue

T initialValue()
Invoked when HystrixRequestVariable.get() is first called.

When using the default implementation this is invoked when HystrixRequestVariableDefault.get() is called.

Returns:
T with initial value or null if none.

shutdown

void shutdown(T value)
Invoked when request scope is shutdown to allow for cleanup.

When using the default implementation this is invoked when HystrixRequestContext.shutdown() is called.

The HystrixRequestVariable.get() method should not be called from within this method as it will result in HystrixRequestVariableLifecycle.initialValue() being called again.

Parameters:
value - of request variable to allow cleanup activity.

If nothing needs to be cleaned up then nothing needs to be done in this method.