Package com.atlassian.bamboo.chains
Class ExecutionContextImpl
java.lang.Object
com.atlassian.bamboo.chains.ExecutionContext
com.atlassian.bamboo.chains.ExecutionContextImpl
Stores non-persistant contextual data during the execution of a
Chain
and its ChainStage
s
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()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(Key<?> key) <V> V
<V> V
putIfAbsent
(Key<V> key, V value) boolean
<V> boolean
values()
-
Constructor Details
-
ExecutionContextImpl
public ExecutionContextImpl()
-
-
Method Details
-
getValue
- Specified by:
getValue
in classExecutionContext
-
containsKey
- Specified by:
containsKey
in classExecutionContext
-
remove
- Specified by:
remove
in classExecutionContext
-
values
- Specified by:
values
in classExecutionContext
-
putIfAbsent
- Specified by:
putIfAbsent
in classExecutionContext
-
replace
- Specified by:
replace
in classExecutionContext
-