public abstract class TaskContext
extends java.lang.Object
Runnable
or Callable
started
through the FlowContext.submitTask(Callable, TaskInfo)
methods.Lock
shared with the user requests serving thread.unlock()
as soon as the Task executes a long running operation that does
not directly modifies shared data, such as a jpa query, and lock()
before
changing shared data.Constructor and Description |
---|
TaskContext() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addStep(TaskStep step) |
static TaskContext |
get() |
abstract TaskStep |
getCurrentStep() |
abstract boolean |
isLockHeldByCurrentThread() |
abstract void |
lock()
Locks the
Lock shared with the user requests serving thread, which
means that no user request is served while the lock is acquired.Use yieldLock() or unlock() to let the user requests serving
thread do its job. |
abstract void |
set(TaskInfo ti) |
abstract boolean |
unlock()
See
lock() . |
abstract void |
yieldLock()
Should be called by the task to let the web-container thread do its job.
Call it often and when there is a consistent state. Lock is automatically re-acquired. It makes sense if a lock() has been taken. |
public static final TaskContext get()
public abstract void set(TaskInfo ti)
public abstract void addStep(TaskStep step)
public abstract TaskStep getCurrentStep()
public abstract void yieldLock()
lock()
has been taken.public abstract boolean unlock()
lock()
.public abstract void lock()
Lock
shared with the user requests serving thread, which
means that no user request is served while the lock is acquired.yieldLock()
or unlock()
to let the user requests serving
thread do its job.public abstract boolean isLockHeldByCurrentThread()
unlock()
.