Package org.eclipse.ecf.remoteservice
Class RemoteServiceHelper
- java.lang.Object
- 
- org.eclipse.ecf.remoteservice.RemoteServiceHelper
 
- 
 public class RemoteServiceHelper extends Object Helper class for making it easier to call a remote service with method name and optional parameters.- Since:
- 3.0
 
- 
- 
Field SummaryFields Modifier and Type Field Description static longdefaultTimeoutstatic Object[]EMPTY_PARAMS
 - 
Constructor SummaryConstructors Constructor Description RemoteServiceHelper()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static voidasyncExec(IRemoteService remoteService, String method, Object[] parameters, long timeout, IRemoteCallListener listener)Invoke given method asynchronously, and call listener upon successful completion.static voidasyncExec(IRemoteService remoteService, String method, Object[] parameters, IRemoteCallListener listener)Invoke given method asynchronously, and call listener upon successful completion.static org.eclipse.equinox.concurrent.future.IFuturefutureExec(IRemoteService remoteService, String method, Object[] parameters)Invoke given method asynchronously, return an IFuture immediately that can be subsequently queried for completion.static org.eclipse.equinox.concurrent.future.IFuturefutureExec(IRemoteService remoteService, String method, Object[] parameters, long timeout)Invoke given method asynchronously, return an IFuture immediately that can be subsequently queried for completion.static longgetDefaultTimeout()static voidsetDefaultTimeout(long timeout)static ObjectsyncExec(IRemoteService remoteService, String method, Object[] parameters)Invoke given method synchronously, blocking the calling thread until a result is received or timeout.static ObjectsyncExec(IRemoteService remoteService, String method, Object[] parameters, long timeout)Invoke given method synchronously, blocking the calling thread until a result is received or timeout.
 
- 
- 
- 
Field Detail- 
defaultTimeoutpublic static long defaultTimeout 
 - 
EMPTY_PARAMSpublic static Object[] EMPTY_PARAMS 
 
- 
 - 
Method Detail- 
getDefaultTimeoutpublic static long getDefaultTimeout() 
 - 
setDefaultTimeoutpublic static void setDefaultTimeout(long timeout) 
 - 
asyncExecpublic static void asyncExec(IRemoteService remoteService, String method, Object[] parameters, IRemoteCallListener listener) Invoke given method asynchronously, and call listener upon successful completion. Uses default timeout.- Parameters:
- remoteService- the IRemoteService to invoke. Must not be- null.
- method- the method to invoke. Must not be- null.
- parameters- the parameters associated with the method to invoke. May be- null(no parameters).
- listener- the listener to call back when remote call initiated and completed. Must not be- null.
 
 - 
asyncExecpublic static void asyncExec(IRemoteService remoteService, String method, Object[] parameters, long timeout, IRemoteCallListener listener) Invoke given method asynchronously, and call listener upon successful completion.- Parameters:
- remoteService- the IRemoteService to invoke. Must not be- null.
- method- the method to invoke. Must not be- null.
- parameters- the parameters associated with the method to invoke. May be- null(no parameters).
- timeout- the timeout (in ms) for the remote call.
- listener- the listener to call back when remote call initiated and completed. Must not be- null.
 
 - 
futureExecpublic static org.eclipse.equinox.concurrent.future.IFuture futureExec(IRemoteService remoteService, String method, Object[] parameters, long timeout) Invoke given method asynchronously, return an IFuture immediately that can be subsequently queried for completion.- Parameters:
- remoteService- the IRemoteService to invoke. Must not be- null.
- method- the method to invoke. Must not be- null.
- parameters- the parameters associated with the method to invoke. May be- null(no parameters).
- timeout- the timeout (in ms) for the remote call.
- Returns:
- IFuture the future created
 
 - 
futureExecpublic static org.eclipse.equinox.concurrent.future.IFuture futureExec(IRemoteService remoteService, String method, Object[] parameters) Invoke given method asynchronously, return an IFuture immediately that can be subsequently queried for completion. Uses default timeout.- Parameters:
- remoteService- the IRemoteService to invoke. Must not be- null.
- method- the method to invoke. Must not be- null.
- parameters- the parameters associated with the method to invoke. May be- null(no parameters).
- Returns:
- IFuture the future created
 
 - 
syncExecpublic static Object syncExec(IRemoteService remoteService, String method, Object[] parameters, long timeout) throws ECFException Invoke given method synchronously, blocking the calling thread until a result is received or timeout.- Parameters:
- remoteService- the IRemoteService to invoke. Must not be- null.
- method- the method to invoke. Must not be- null.
- parameters- the parameters associated with the method to invoke. May be- null(no parameters).
- timeout- the timeout (in ms) for the remote call.
- Returns:
- Object the result of this synchronous execution
- Throws:
- ECFException- if some problem with execution
 
 - 
syncExecpublic static Object syncExec(IRemoteService remoteService, String method, Object[] parameters) throws ECFException Invoke given method synchronously, blocking the calling thread until a result is received or timeout. Uses default timeout.- Parameters:
- remoteService- the IRemoteService to invoke. Must not be- null.
- method- the method to invoke. Must not be- null.
- parameters- the parameters associated with the method to invoke. May be- null(no parameters).
- Returns:
- Object the result of this synchronous execution
- Throws:
- ECFException- if some problem with execution
 
 
- 
 
-