public class DaemonCommandExecution extends Object
Facilitates processing ?chains?, making it easier to break up processing logic into discrete actions.
The given actions will be executed in the order given to the constructor, and should use the proceed() method to allow
the next action to run. If an action does not call proceed(), it will be the last action that executes.
| Constructor and Description |
|---|
DaemonCommandExecution(DisconnectAwareConnection<Object> connection,
Command command,
DaemonContext daemonContext,
DaemonStateCoordinator daemonStateCoordinator,
List<DaemonCommandAction> actions) |
| Modifier and Type | Method and Description |
|---|---|
void |
addFinalizer(Runnable runnable) |
void |
executeFinalizers() |
Command |
getCommand()
The command to execute.
|
DisconnectAwareConnection<Object> |
getConnection() |
DaemonContext |
getDaemonContext() |
DaemonStateCoordinator |
getDaemonStateCoordinator() |
Throwable |
getException()
The currently nominated error that occurred during executing the commmand.
|
Object |
getResult()
The currently nominated result for the execution.
|
boolean |
proceed()
Continues (or starts) execution.
|
void |
setException(Throwable exception)
If an exception happens in actioning the command that is to be expected (e.g.
|
void |
setResult(Object result)
Sets what is to be considered the result of executing the command.
|
String |
toString() |
public DaemonCommandExecution(DisconnectAwareConnection<Object> connection, Command command, DaemonContext daemonContext, DaemonStateCoordinator daemonStateCoordinator, List<DaemonCommandAction> actions)
public DisconnectAwareConnection<Object> getConnection()
public Command getCommand()
If the client disconnects before sending a command, this will be null.
public DaemonContext getDaemonContext()
public DaemonStateCoordinator getDaemonStateCoordinator()
public void setResult(Object result)
This may be called multiple times to do things like wrap the result in another type.
public Object getResult()
If getException() returns non null, the actual ?result? of executing the command should be considered
to be that exception and not what is returned by this method.
May be null if no action has set the result yet.
public void setException(Throwable exception)
public Throwable getException()
public boolean proceed()
Each action should call this method if it determines that execution should continue.
public void addFinalizer(Runnable runnable)
public void executeFinalizers()
Copyright © 2013. All rights reserved