Package com.atlassian.bamboo.chains
Class ExecutionContextImpl
java.lang.Object
com.atlassian.bamboo.chains.ExecutionContext
com.atlassian.bamboo.chains.ExecutionContextImpl
- All Implemented Interfaces:
Serializable
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()- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(Key<?> key) <V> V<V> VputIfAbsent(Key<V> key, V value) boolean<V> booleanvalues()
-
Constructor Details
-
ExecutionContextImpl
public ExecutionContextImpl()
-
-
Method Details
-
getValue
- Specified by:
getValuein classExecutionContext
-
containsKey
- Specified by:
containsKeyin classExecutionContext
-
remove
- Specified by:
removein classExecutionContext
-
values
- Specified by:
valuesin classExecutionContext
-
putIfAbsent
- Specified by:
putIfAbsentin classExecutionContext
-
replace
- Specified by:
replacein classExecutionContext
-