Package org.eclipse.ecf.remoteservice
Interface IRemoteService
- All Known Implementing Classes:
AbstractClientService
,AbstractRemoteService
,AbstractRestClientService
,AbstractRSAClientService
,RemoteServiceImpl
,RestClientService
public interface IRemoteService
Interface providing runtime access to a remote service. An instance
implementing this interface will be returned from the
IRemoteServiceContainerAdapter.getRemoteService(IRemoteServiceReference) and
may then be used to communicate with a remote service. The methods on this
interface support accessing the remote service in several ways:
- callSync -- A synchronous invocation that will block the calling thread until complete (or timeout) and return the result from the remote or throw exception if remote invocation fails or throws exception
- callAsync/1 -- An asynchronous invocation that will not block the caller
thread but rather return a non-
null
IFuture
instance that can be polled for results. SeeIFuture.get()
,IFuture.get(long)
, andIFuture.isDone()
. timeout, exception, or successful completion) - callAsync/2 -- An asynchronous invocation that will not block the caller thread but rather notify the given listener asynchronously when complete (via timeout, exception, or successful completion)
- fireAsync -- An asynchronous invocation that will simply execute the remote method asynchronously, but will not provide any response or remote method failure information
- getProxy -- Access to a local proxy for the remote service that will expose the appropriate interface to the caller, and synchronously call the remote methods when invoked.
-
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.equinox.concurrent.future.IFuture
callAsync
(IRemoteCall call) Call remote method specified by call parameter asynchronously, and immediately returnIFuture
instance.void
callAsync
(IRemoteCall call, IRemoteCallListener listener) Call remote method specified by call parameter asynchronously, and notify specified listener when call starts and completes.callSync
(IRemoteCall call) Call remote method specified by call parameter synchronously.void
fireAsync
(IRemoteCall call) Fire remote method specified by call parameter.getProxy()
Get local proxy for remote interface.getProxy
(ClassLoader cl, Class[] interfaceClasses) Get local proxy for remote interface.
-
Method Details
-
callSync
Call remote method specified by call parameter synchronously.- Parameters:
call
- the remote call to make- Returns:
- Object the result of the call. Will be
null
if remote providesnull
as result. - Throws:
ECFException
- thrown if disconnect occurs, caller not currently connected, or remote throws Exception- Since:
- 3.0
-
callAsync
Call remote method specified by call parameter asynchronously, and notify specified listener when call starts and completes.- Parameters:
call
- the remote call to make. Must not benull
.listener
- the listener to notify when call starts and is completed. The listener will be notified via the two event types IRemoteCallStartEvent and IRemoteCallCompleteEvent. Must not benull
.- Since:
- 3.0
- See Also:
-
callAsync
Call remote method specified by call parameter asynchronously, and immediately returnIFuture
instance. Returned IFuture will not benull
, and allows the caller to retrieve the actual resulting value from the remote call (or exception).- Parameters:
call
- the remote call to make. Must not benull
.- Returns:
- IFuture the asynchronous result to allow the caller to poll
for whether the result
IFuture.isDone()
, and then toIFuture.get()
the actual result. - Since:
- 3.0
-
fireAsync
Fire remote method specified by call parameter. The remote method will be invoked as a result of asynchronous message send, but no failure/exception information will be returned, and no result will be returned- Parameters:
call
- the remote call to make. Must not benull
.- Throws:
ECFException
- if caller not currently connected- Since:
- 3.0
-
getProxy
Get local proxy for remote interface. The local proxy may then be used to make remote method calls transparently by invoking the local proxy method- Returns:
- Object that implements the interface specified in the
IRemoteServiceReference instance used to retrieve the
IRemoteService object. The result may then be cast to the
appropriate type. Will not be
null
. - Throws:
ECFException
- If some problem in creating the proxy. The underlying problem is conveyed in the nested exception.
-
getProxy
Get local proxy for remote interface. The local proxy may then be used to make remote method calls transparently by invoking the local proxy method- Parameters:
cl
- ClassLoader to use to create the proxy class. Must not benull
.interfaceClasses
- array of Class that has the loaded interface classes. Must not benull
and should have dimension of one or more.- Returns:
- Object that implements the given interfaceClasses. The result may then
be cast to the one of the types given in interfaceClasses. Will not be
null
- Throws:
ECFException
- If some problem in creating the proxy. The underlying problem is conveyed in the nested exception.- Since:
- 6.0
-