public class DefaultExecutionContextImpl<R> extends Object implements ExecutionContext<R>
Constructor and Description |
---|
DefaultExecutionContextImpl(ConcurrentHashMap<String,ExecutedTask<R>> tasksInProgress,
Object userData) |
Modifier and Type | Method and Description |
---|---|
<T> T |
getContextAttribute(String name)
Returns value of given context attribute or null of there is no such attribute.
|
Collection<ExecutedTask<R>> |
getExecutionsInProgress()
Returns collection of Tasks which are currently executed by circuit breaker.
|
<U> U |
getUserData()
Returns custom data that could haven been passed to the circuit breaker when executing Task.
|
boolean |
hasContextAttribute(String name)
Return true if context attribute with given name exists.
|
<T> void |
setContextAttribute(String name,
T value)
Creates or sets new value for context attribute with given name.
|
public DefaultExecutionContextImpl(ConcurrentHashMap<String,ExecutedTask<R>> tasksInProgress, Object userData)
public Collection<ExecutedTask<R>> getExecutionsInProgress()
ExecutionContext
getExecutionsInProgress
in interface ExecutionContext<R>
ExecutedTask
.public <U> U getUserData()
ExecutionContext
getUserData
in interface ExecutionContext<R>
U
- user custom data passed to the breakerpublic <T> void setContextAttribute(String name, T value)
ExecutionContext
setContextAttribute
in interface ExecutionContext<R>
T
- the type of attribute to setname
- the name under which the attribute will be availablevalue
- the value of the atributepublic boolean hasContextAttribute(String name)
ExecutionContext
hasContextAttribute
in interface ExecutionContext<R>
name
- name of the attribute that might have been set for current executionpublic <T> T getContextAttribute(String name)
ExecutionContext
getContextAttribute
in interface ExecutionContext<R>
T
- the type to which the value of the attribute with given name should be cast toname
- name of the attribute that might have been set for current executionExecutionContext.hasContextAttribute(String)
Copyright © 2017. All rights reserved.