public class TerminableFuture<E> extends Future<E> implements ITerminableFuture<E>
IForwardCommandFuture.Type
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<ICommand<java.lang.Object>,IFilter<java.lang.Object>> |
bcommands
The list of backward commands.
|
protected ITerminationCommand |
terminate
The termination code.
|
CALLER_QUEUED, CALLER_RESUMED, CALLER_SUSPENDED, callers, creation, DEBUG, exception, fcommands, first, listener, listeners, NO_STACK_COMPACTION, NONE, result, resultavailable, STACK, undone, UNSET
Constructor and Description |
---|
TerminableFuture()
Create a new future.
|
TerminableFuture(ITerminationCommand terminate)
Create a future that is already done.
|
Modifier and Type | Method and Description |
---|---|
void |
addBackwardCommand(IFilter<java.lang.Object> filter,
ICommand<java.lang.Object> command)
Add a backward command with a filter.
|
void |
removeBackwardCommand(ICommand<java.lang.Object> command)
Add a command with a filter.
|
void |
sendBackwardCommand(java.lang.Object info)
Send a backward command in direction of the source.
|
void |
setTerminationCommand(ITerminationCommand terminate)
Set the termination command.
|
void |
terminate()
Terminate the future.
|
void |
terminate(java.lang.Exception reason)
Terminate the future and supply a custom reason.
|
abortGet, acceptEither, addForwardCommand, addResultListener, addResultListener, addResultListener, applyToEither, doSetException, doSetResult, get, get, get, getEmptyFuture, getException, getFuture, hasResultListener, isDone, notifyListener, notifyListenerCommand, removeForwardCommand, resume, sendForwardCommand, setException, setExceptionIfUndone, setResult, setResultIfUndone, thenAccept, thenAccept, thenApply, thenApply, thenCombine, thenCompose, thenCompose
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
acceptEither, addResultListener, addResultListener, addResultListener, applyToEither, get, get, get, getException, isDone, thenAccept, thenAccept, thenApply, thenApply, thenCombine, thenCompose, thenCompose
protected ITerminationCommand terminate
public TerminableFuture()
public TerminableFuture(ITerminationCommand terminate)
result
- The result, if any.public void terminate()
terminate
in interface ITerminableFuture<E>
public void terminate(java.lang.Exception reason)
terminate
in interface ITerminableFuture<E>
public void sendBackwardCommand(java.lang.Object info)
sendBackwardCommand
in interface IBackwardCommandFuture
info
- The command info.public void addBackwardCommand(IFilter<java.lang.Object> filter, ICommand<java.lang.Object> command)
public void removeBackwardCommand(ICommand<java.lang.Object> command)
public void setTerminationCommand(ITerminationCommand terminate)
terminate
- The termination command.