public class CommandSender extends Object
| Constructor and Description |
|---|
CommandSender(org.lsst.ccs.messaging.AgentMessagingLayer messenger,
Executor callbackExecutor,
Executor workerExecutor,
org.lsst.ccs.utilities.scheduler.Scheduler timer)
Creates an instance of
CommandSender. |
| Modifier and Type | Method and Description |
|---|---|
CommandTask |
execute(CommandHandle handle,
Duration timeout,
String command,
Object... args)
Sends a command to a remote subsystem.
|
void |
setCommandHandle(CommandHandle defaultCommandHandle)
Sets the default command handle for this sender.
|
void |
setTimeout(Duration defaultTimeout)
Sets the default command timeout for this sender.
|
public CommandSender(org.lsst.ccs.messaging.AgentMessagingLayer messenger,
Executor callbackExecutor,
Executor workerExecutor,
org.lsst.ccs.utilities.scheduler.Scheduler timer)
CommandSender.messenger - Messaging access point. If null, the environment messaging access will be used.callbackExecutor - Executor for running CommandHandle methods. If null, a dedicated single-threaded executor will be created.workerExecutor - Executor for running potentially time-consuming tasks. If null, a dedicated executor will be created.timer - Scheduling executor for timing commands.public void setTimeout(Duration defaultTimeout)
defaultTimeout - Default timeout. Zero means the command will never time out.
Negative timeout means its absolute value will be used and the custom timeout
suggested by the target subsystem through an ACK will be ignored.public void setCommandHandle(CommandHandle defaultCommandHandle)
defaultCommandHandle - Default command handle.public CommandTask execute(CommandHandle handle, Duration timeout, String command, Object... args)
get() or getResult()
on the CommandTask returned by this method.handle - Handle for processing the command responses.
If null, the default command handle of this sender will be used if it has been set,
or no processing will be performed if it has not been set..timeout - Timeout. If null, the default timeout of this sender will be used.
Zero means the command will never time out.
Negative timeout means its absolute value will be used and the custom timeout
suggested by the target subsystem through an ACK will be ignored.command - Command in subsystem/path format.args - Command arguments.Copyright © 2019 LSST. All rights reserved.