Class ExecutionContextImpl


  • @PublicApi
    public final class ExecutionContextImpl
    extends ExecutionContext
    Stores non-persistant contextual data during the execution of a Chain and its ChainStages Key references are weak. The key and value will be garbage collected if the Key reference is lost. Plugin developers may put their own objects into the ExecutionContextImpl to pass information between ChainExecutionManager plugin points. All values remain on the server and are never sent over the network to the Agent and values are no longer available once the Chain finishes executing To store objects in the ExecutionContextImpl first create a key (We recommend that you declare this as static final in one of your classes): Key<MyPluginState> myKey = Key.create(MyPluginState.class); Using the key we can store a new reference of MyPluginState into the ExecutionContextImpl ExecutionContext context = chainExecution.getExecutionContext(); context.putIfAbsent(myKey, new MyPluginState()); To retrieve your object: MyPluginState state = context.getValue(myKey); See ChainExecution.getExecutionContext() and StageExecution.getExecutionContext()