Package com.atlassian.bamboo.chains
Class ExecutionContextImpl
- java.lang.Object
-
- com.atlassian.bamboo.chains.ExecutionContext
-
- com.atlassian.bamboo.chains.ExecutionContextImpl
-
@PublicApi public final class ExecutionContextImpl extends ExecutionContext
Stores non-persistant contextual data during the execution of aChain
and itsChainStage
sKey
references are weak. The key and value will be garbage collected if theKey
reference is lost. Plugin developers may put their own objects into theExecutionContextImpl
to pass information betweenChainExecutionManager
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 theChain
finishes executing To store objects in theExecutionContextImpl
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 theExecutionContextImpl
ExecutionContext context = chainExecution.getExecutionContext(); context.putIfAbsent(myKey, new MyPluginState()); To retrieve your object: MyPluginState state = context.getValue(myKey); SeeChainExecution.getExecutionContext()
andStageExecution.getExecutionContext()
-
-
Constructor Summary
Constructors Constructor Description ExecutionContextImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(Key<?> key)
<V> V
getValue(Key<V> key)
<V> V
putIfAbsent(Key<V> key, V value)
boolean
remove(Key<?> key, Object value)
<V> boolean
replace(Key<?> key, V oldValue, V newValue)
Collection<Object>
values()
-
-
-
Method Detail
-
getValue
@Nullable public <V> V getValue(Key<V> key)
- Specified by:
getValue
in classExecutionContext
-
containsKey
public boolean containsKey(Key<?> key)
- Specified by:
containsKey
in classExecutionContext
-
remove
public boolean remove(Key<?> key, Object value)
- Specified by:
remove
in classExecutionContext
-
values
public Collection<Object> values()
- Specified by:
values
in classExecutionContext
-
putIfAbsent
public <V> V putIfAbsent(Key<V> key, V value)
- Specified by:
putIfAbsent
in classExecutionContext
-
replace
public <V> boolean replace(Key<?> key, V oldValue, V newValue)
- Specified by:
replace
in classExecutionContext
-
-