@PublicApi public final class ExecutionContextImpl extends ExecutionContext
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 and Description |
---|
ExecutionContextImpl() |
Modifier and Type | Method and 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() |
@Nullable public <V> V getValue(Key<V> key)
getValue
in class ExecutionContext
public boolean containsKey(Key<?> key)
containsKey
in class ExecutionContext
public boolean remove(Key<?> key, Object value)
remove
in class ExecutionContext
public Collection<Object> values()
values
in class ExecutionContext
public <V> V putIfAbsent(Key<V> key, V value)
putIfAbsent
in class ExecutionContext
public <V> boolean replace(Key<?> key, V oldValue, V newValue)
replace
in class ExecutionContext
Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.
View cookie preferences