public class RemoteServer extends Server<RemoteMethod>
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_TIMEOUT
Default timeout used to wait for method replies before throwing an
exception [sec].
|
Constructor and Description |
---|
RemoteServer(RemoteServerCreateArgs args)
Create a new RemoteServer object that provides its methods under the
scope @a scope.
|
Modifier and Type | Method and Description |
---|---|
Event |
call(String name)
Calls a method of the server without request parameter using the method
name.
|
Event |
call(String name,
double timeout)
Calls a method of the server without request parameter using the method
name.
|
Event |
call(String name,
Event event)
Calls a method of the server using the method name and request data
encapsulated in an
Event instance. |
Event |
call(String name,
Event event,
double timeout)
Calls a method of the server using the method name and request data
encapsulated in an
Event instance. |
<ReplyType,RequestType> |
call(String name,
RequestType data)
Calls a method of the server using the method name and plain request
data.
|
<ReplyType,RequestType> |
call(String name,
RequestType data,
double timeout)
Calls a method of the server using the method name and plain request
data.
|
Future<Event> |
callAsync(String name)
Calls a method of the server without request parameter using the method
name.
|
Future<Event> |
callAsync(String name,
Event event)
Calls a method of the server using the method name and request data
encapsulated in an
Event instance. |
<ReplyType,RequestType> |
callAsync(String name,
RequestType data)
Calls a method of the server using the method name and plain request
data.
|
Class<?> |
getDataType()
Returns the data type transfered by this participant.
|
String |
getKind()
Returns kind of participant in RSB terminology.
|
double |
getTimeout()
Returns the timeout used when waiting for replies from a server.
|
activate, addMethod, deactivate, getMethod, getMethods, getTransportUris, hasMethod, isActive
getConfig, getId, getObserverManager, getScope, setObserverManager
public static final double DEFAULT_TIMEOUT
public RemoteServer(RemoteServerCreateArgs args)
args
- The arguments to use for this new instance. The scope is the
common super-scope under which the methods of the remote
created server are provided.public double getTimeout()
public Future<Event> callAsync(String name, Event event) throws RSBException
Event
instance. The method returns immediately
with a Future
instance.name
- name of the method to callevent
- request dataFuture
instance to retrieve the
result Event
RSBException
- communication errors or server-side errorspublic Future<Event> callAsync(String name) throws RSBException
Future
instance.name
- name of the method to callFuture
instance to retrieve the
result Event
RSBException
- communication errors or server-side errorspublic <ReplyType,RequestType> Future<ReplyType> callAsync(String name, RequestType data) throws RSBException
Future
instance.ReplyType
- the data type expected as the reply dataRequestType
- the data type for the passed in request dataname
- name of the method to calldata
- the data to transfer as the method's request parameterFuture
instance to retrieve the
result dataRSBException
- communication errors or server-side errorspublic Event call(String name, Event event) throws RSBException, ExecutionException, TimeoutException, InterruptedException
Event
instance. The method blocks until the
server replied or until the timeout is reached.name
- name of the method to callevent
- request dataRSBException
- communication errors or server-side errorsTimeoutException
- timeout waiting for the replyExecutionException
- in case the method failed on the server sideInterruptedException
- interrupted while waiting for the replyCancellationException
- waiting for the result was cancelledpublic Event call(String name, Event event, double timeout) throws RSBException, ExecutionException, TimeoutException, InterruptedException
Event
instance. The method blocks until the
server replied or until the specified timeout is reached.name
- name of the method to callevent
- request datatimeout
- seconds to wait for the replyRSBException
- communication errors or server-side errorsTimeoutException
- timeout waiting for the replyExecutionException
- in case the method failed on the server sideInterruptedException
- interrupted while waiting for the replyCancellationException
- waiting for the result was cancelledpublic Event call(String name) throws RSBException, ExecutionException, TimeoutException, InterruptedException
name
- name of the method to callRSBException
- communication errors or server-side errorsTimeoutException
- timeout waiting for the replyExecutionException
- in case the method failed on the server sideInterruptedException
- interrupted while waiting for the replyCancellationException
- waiting for the result was cancelledpublic Event call(String name, double timeout) throws RSBException, ExecutionException, TimeoutException, InterruptedException
name
- name of the method to calltimeout
- seconds to wait for the replyRSBException
- communication errors or server-side errorsTimeoutException
- timeout waiting for the replyExecutionException
- in case the method failed on the server sideInterruptedException
- interrupted while waiting for the replyCancellationException
- waiting for the result was cancelledpublic <ReplyType,RequestType> ReplyType call(String name, RequestType data) throws RSBException, ExecutionException, TimeoutException, InterruptedException
ReplyType
- the data type expected for the reply dataRequestType
- the data type of the passed in request dataname
- name of the method to calldata
- request dataRSBException
- communication errors or server-side errorsTimeoutException
- timeout waiting for the replyExecutionException
- in case the method failed on the server sideInterruptedException
- interrupted while waiting for the replyCancellationException
- waiting for the result was cancelledpublic <ReplyType,RequestType> ReplyType call(String name, RequestType data, double timeout) throws RSBException, ExecutionException, TimeoutException, InterruptedException
ReplyType
- the data type expected for the reply dataRequestType
- the data type of the passed in request dataname
- name of the method to calldata
- request datatimeout
- seconds to wait for the replyRSBException
- communication errors or server-side errorsTimeoutException
- timeout waiting for the replyExecutionException
- in case the method failed on the server sideInterruptedException
- interrupted while waiting for the replyCancellationException
- waiting for the result was cancelledpublic String getKind()
Participant
getKind
in class Participant
public Class<?> getDataType()
Participant
getDataType
in class Participant
null
if not applicable for this type of
participantCopyright © 2018 CoR-Lab. All rights reserved.