com.atlassian.bamboo.chains
Class ExecutionContext

java.lang.Object
  extended by com.atlassian.bamboo.chains.ExecutionContext

public final class ExecutionContext
extends java.lang.Object

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 ExecutionContext 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 ExecutionContext first create a key (We recommend that you declare this as static final in one of your classes): Key myKey = Key.create(MyPluginState.class); Using the key we can store a new reference of MyPluginState into the ExecutionContext 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
ExecutionContext()
           
 
Method Summary
 boolean containsKey(Key<?> key)
           
<V> V
getValue(Key<V> key)
           
<V> V
putIfAbsent(Key<V> key, V value)
           
 boolean remove(Key<?> key, java.lang.Object value)
           
<V> boolean
replace(Key<?> key, V oldValue, V newValue)
           
 java.util.Collection<java.lang.Object> values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecutionContext

public ExecutionContext()
Method Detail

getValue

@Nullable
public <V> V getValue(Key<V> key)

containsKey

public boolean containsKey(Key<?> key)

remove

public boolean remove(Key<?> key,
                      java.lang.Object value)

values

public java.util.Collection<java.lang.Object> values()

putIfAbsent

public <V> V putIfAbsent(Key<V> key,
                         V value)

replace

public <V> boolean replace(Key<?> key,
                           V oldValue,
                           V newValue)


Copyright © 2011 Atlassian. All Rights Reserved.