public static class DynamicTasks.TaskQueueingResult<T> extends java.lang.Object implements TaskWrapper<T>
Modifier and Type | Method and Description |
---|---|
T |
andWaitForSuccess()
blocks for the task to be completed
|
Task<T> |
asTask() |
DynamicTasks.TaskQueueingResult<T> |
executionContext(Entity entity)
as
executionContext(ExecutionContext) but inferring from the entity |
DynamicTasks.TaskQueueingResult<T> |
executionContext(ExecutionContext execContext)
specifies an execContext to use if the task has to be explicitly submitted;
if omitted it will attempt to find one based on the current thread's context
|
Task<T> |
getTask() |
boolean |
isQueuedOrSubmitted()
returns true if the task either is currently queued or has been submitted
|
void |
orCancel() |
DynamicTasks.TaskQueueingResult<T> |
orSubmitAndBlock()
causes the task to be submitted *synchronously* if it hasn't already been submitted;
useful in contexts such as libraries where callers may be either on a legacy call path
(which assumes all commands complete immediately);
requiring an entity execution context (will try to find a default if not set)
|
DynamicTasks.TaskQueueingResult<T> |
orSubmitAndBlock(Entity entity)
convenience for setting
executionContext(ExecutionContext) then submitting blocking |
DynamicTasks.TaskQueueingResult<T> |
orSubmitAsync()
causes the task to be submitted (asynchronously) if it hasn't already been,
requiring an entity execution context (will try to find a default if not set)
|
DynamicTasks.TaskQueueingResult<T> |
orSubmitAsync(Entity entity)
convenience for setting
executionContext(ExecutionContext) then submitting async |
boolean |
wasQueued()
returns true if the task was queued
|
public Task<T> asTask()
asTask
in interface TaskAdaptable<T>
public Task<T> getTask()
getTask
in interface TaskWrapper<T>
public boolean wasQueued()
public boolean isQueuedOrSubmitted()
public DynamicTasks.TaskQueueingResult<T> executionContext(ExecutionContext execContext)
public DynamicTasks.TaskQueueingResult<T> executionContext(Entity entity)
executionContext(ExecutionContext)
but inferring from the entitypublic DynamicTasks.TaskQueueingResult<T> orSubmitAsync()
public DynamicTasks.TaskQueueingResult<T> orSubmitAsync(Entity entity)
executionContext(ExecutionContext)
then submitting asyncpublic DynamicTasks.TaskQueueingResult<T> orSubmitAndBlock()
public DynamicTasks.TaskQueueingResult<T> orSubmitAndBlock(Entity entity)
executionContext(ExecutionContext)
then submitting blockingpublic T andWaitForSuccess()
needed in any context where subsequent commands assume the task has completed. not needed in a context where the task is simply being built up and queued.
throws if there are any errors
public void orCancel()