public abstract class Scope extends Object
AggregateLifecycle
or
SagaLifecycle
.AggregateLifecycle
,
SagaLifecycle
Constructor and Description |
---|
Scope() |
Modifier and Type | Method and Description |
---|---|
static ScopeDescriptor |
describeCurrentScope()
Provide a description of the current
Scope . |
abstract ScopeDescriptor |
describeScope()
Provide a description of this
Scope . |
protected void |
endScope()
|
protected <V> V |
executeWithResult(Callable<V> task)
|
static <S extends Scope> |
getCurrentScope()
Retrieve the current
Scope . |
protected void |
startScope()
|
public static <S extends Scope> S getCurrentScope() throws IllegalStateException
Scope
.S
- a type implementing Scope
Scope
IllegalStateException
- in case no current Scope
is active, in which case #startScope() should be
called firstpublic static ScopeDescriptor describeCurrentScope()
Scope
.ScopeDescriptor
describing the current Scope
protected void startScope()
protected void endScope()
Scope
by removing this
from a Deque
contained in a
ThreadLocal
.
If this
isn't on the top of the Deque, an IllegalStateException
will be thrown, as that signals a
process is trying to end somebody else's scope.
If the Deque is empty, it will be removed from the ThreadLocal.protected <V> V executeWithResult(Callable<V> task) throws Exception
Scope
instance method to execute given task
of type Callable
in the context of this
Scope. This updates the thread's current scope before executing the task. If a scope is already registered with
the current thread that one will be temporarily replaced with this scope until the task completes. This method
returns the execution result of the task.public abstract ScopeDescriptor describeScope()
Scope
.ScopeDescriptor
describing this Scope
Copyright © 2010–2018. All rights reserved.