Package ej.rcommand.synchronous
Class RemoteCommandClient
- java.lang.Object
-
- ej.rcommand.synchronous.RemoteCommandClient
-
-
Constructor Summary
Constructors Constructor Description RemoteCommandClient(StreamRemoteConnection connection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Texecute(Command<T> command, long timeout)Executes the command and waits for the result.voidregisterNotificationListener(RemoteNotificationListener listener)Registers the given notification listener.voidrun()When an object implementing interfaceRunnableis used to create a thread, starting the thread causes the object'srunmethod to be called in that separately executing thread.voidstop()Stops the client.
-
-
-
Constructor Detail
-
RemoteCommandClient
public RemoteCommandClient(StreamRemoteConnection connection)
-
-
Method Detail
-
registerNotificationListener
public void registerNotificationListener(RemoteNotificationListener listener)
Registers the given notification listener.- Parameters:
listener- the notification listener to register.
-
run
public void run()
Description copied from interface:RunnableWhen an object implementing interfaceRunnableis used to create a thread, starting the thread causes the object'srunmethod to be called in that separately executing thread.The general contract of the method
runis that it may take any action whatsoever.- Specified by:
runin interfaceRunnable- See Also:
Thread.run()
-
execute
public <T> T execute(Command<T> command, long timeout) throws IOException, InterruptedException, TimeoutException
Executes the command and waits for the result.- Parameters:
command- the command to execute.timeout- the timeout in milliseconds.- Returns:
- the result of the command.
- Throws:
IOException- if an I/O error occurs.InterruptedExceptionTimeoutException- if the response of the command is not received before timeout.
-
stop
public void stop()
Stops the client.
-
-