public interface ServiceController
| Modifier and Type | Method and Description |
|---|---|
void |
awaitTerminated()
Waits for termination of the remote service.
|
void |
awaitTerminated(long timeout,
TimeUnit timeoutUnit)
Waits for termination of the remote service for no more than the given timeout limit.
|
RunId |
getRunId()
Returns the
RunId of the running application. |
void |
kill()
Requests to forcefully kill a running service.
|
void |
onRunning(Runnable runnable,
Executor executor)
Attaches a
Runnable that will get executed when the service is running. |
void |
onTerminated(Runnable runnable,
Executor executor)
Attaches a
Runnable that will get executed when the serivce is terminated. |
Future<Command> |
sendCommand(Command command)
Sends a user command to the running application.
|
Future<Command> |
sendCommand(String runnableName,
Command command)
Sends a user command to the given runnable of the running application.
|
Future<? extends ServiceController> |
terminate()
Requests to terminate the running service.
|
Future<Command> sendCommand(Command command)
command - The command to send.Future that will be completed when the command is successfully processed
by the target application.Future<Command> sendCommand(String runnableName, Command command)
runnableName - Name of the TwillRunnable.command - The command to send.Future that will be completed when the command is successfully processed
by the target runnable.Future<? extends ServiceController> terminate()
Future representing the termination state
will be returned.Future that represents the termination of the service. The future result will be
this ServiceController. If the service terminated due to exception, the future will carry the exception.void kill()
void onRunning(Runnable runnable, Executor executor)
Runnable that will get executed when the service is running.runnable - the Runnable to be executed when the service is running.executor - the executor in which the runnable will be executed with.void onTerminated(Runnable runnable, Executor executor)
Runnable that will get executed when the serivce is terminated.runnable - the Runnable to be executed when the service is terminated.executor - the executor in which the runnable will be executed with.void awaitTerminated()
throws ExecutionException
ExecutionException - if the service terminated due to exception.void awaitTerminated(long timeout,
TimeUnit timeoutUnit)
throws TimeoutException,
ExecutionException
timeout - the maximum time to waittimeoutUnit - the time unit of the timeoutTimeoutException - if the service is not terminated within the given time.ExecutionException - if the service terminated due to exception.Copyright © 2013-2016 The Apache Software Foundation. All rights reserved.