Package com.atlassian.bamboo.chains
Class ExecutionContextImpl
- java.lang.Object
-
- com.atlassian.bamboo.chains.ExecutionContext
-
- com.atlassian.bamboo.chains.ExecutionContextImpl
-
- All Implemented Interfaces:
Serializable
@PublicApi public final class ExecutionContextImpl extends ExecutionContext implements Serializable
Stores non-persistant contextual data during the execution of aChainand itsChainStagesKeyreferences are weak. The key and value will be garbage collected if theKeyreference is lost. Plugin developers may put their own objects into theExecutionContextImplto pass information betweenChainExecutionManagerplugin points. All values remain on the server and are never sent over the network to the Agent and values are no longer available once theChainfinishes executing To store objects in theExecutionContextImplfirst 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 theExecutionContextImplExecutionContext context = chainExecution.getExecutionContext(); context.putIfAbsent(myKey, new MyPluginState()); To retrieve your object: MyPluginState state = context.getValue(myKey); SeeChainExecution.getExecutionContext()andStageExecution.getExecutionContext()- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ExecutionContextImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(Key<?> key)<V> VgetValue(Key<V> key)<V> VputIfAbsent(Key<V> key, V value)booleanremove(Key<?> key, Object value)<V> booleanreplace(Key<?> key, V oldValue, V newValue)Collection<Object>values()
-
-
-
Method Detail
-
getValue
@Nullable public <V> V getValue(Key<V> key)
- Specified by:
getValuein classExecutionContext
-
containsKey
public boolean containsKey(Key<?> key)
- Specified by:
containsKeyin classExecutionContext
-
remove
public boolean remove(Key<?> key, Object value)
- Specified by:
removein classExecutionContext
-
values
public Collection<Object> values()
- Specified by:
valuesin classExecutionContext
-
putIfAbsent
public <V> V putIfAbsent(Key<V> key, V value)
- Specified by:
putIfAbsentin classExecutionContext
-
replace
public <V> boolean replace(Key<?> key, V oldValue, V newValue)
- Specified by:
replacein classExecutionContext
-
-