public class CommandClient extends Object
Constructor and Description |
---|
CommandClient(InetSocketAddress hostAddress,
int requestTimeoutInMs)
Instantiate a client configured to send requests to the specified host address.
|
CommandClient(int localhostPort) |
CommandClient(int localHostPort,
int requestTimeoutInMs)
Instantiate a client configured to send requests to localhost.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
org.eclipse.jetty.client.api.ContentResponse |
sendCommand(ControlCommand.Action action,
String commandParameter)
Send a command and optional command parameter to the server and block until receiving
a response.
|
boolean |
trySendCommand(ControlCommand.Action action)
Send a command with no parameters to the server and wait for a response.
|
boolean |
trySendCommand(ControlCommand.Action action,
String commandParameter)
Send a command with an optional command parameter to the server and wait for a response.
|
public CommandClient(int localHostPort, int requestTimeoutInMs)
localHostPort
- Port that the localhost CommandListener is listening on.requestTimeoutInMs
- Timeout in ms for synchronous requests to timeout.public CommandClient(InetSocketAddress hostAddress, int requestTimeoutInMs)
hostAddress
- The host address of the listening server.requestTimeoutInMs
- Timeout in ms for synchronous requests to timeout.public CommandClient(int localhostPort)
public void close()
public boolean trySendCommand(ControlCommand.Action action)
public boolean trySendCommand(ControlCommand.Action action, String commandParameter)
action
- The command Action to send.commandParameter
- The command parameter, in the form of command/action/parameter.public org.eclipse.jetty.client.api.ContentResponse sendCommand(ControlCommand.Action action, String commandParameter) throws Exception
action
- The command Action to send.commandParameter
- The command parameter, in the form of command/action/parameter.Exception
Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.