Class AbstractRSAClientService
- java.lang.Object
-
- org.eclipse.ecf.remoteservice.asyncproxy.AbstractAsyncProxyRemoteService
-
- org.eclipse.ecf.remoteservice.AbstractRemoteService
-
- org.eclipse.ecf.remoteservice.client.AbstractClientService
-
- org.eclipse.ecf.remoteservice.client.AbstractRSAClientService
-
- All Implemented Interfaces:
InvocationHandler
,IRemoteService
public abstract class AbstractRSAClientService extends AbstractClientService
Abstract client remote service instance. This class should be overridden to implement the abstract invokeAsync, and invokeSync methods, which will be called when the proxy created is called by clients.- Since:
- 8.9
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractRSAClientService.RSARemoteCall
-
Nested classes/interfaces inherited from class org.eclipse.ecf.remoteservice.client.AbstractClientService
AbstractClientService.AsyncResult, AbstractClientService.UriRequest
-
Nested classes/interfaces inherited from class org.eclipse.ecf.remoteservice.AbstractRemoteService
AbstractRemoteService.AsyncArgs, AbstractRemoteService.ProxyClassLoader
-
-
Field Summary
-
Fields inherited from class org.eclipse.ecf.remoteservice.client.AbstractClientService
container, registration
-
Fields inherited from class org.eclipse.ecf.remoteservice.AbstractRemoteService
EMPTY_ARGS, futureExecutorService, futureExecutorServiceMaxThreads, iFutureExecutor
-
-
Constructor Summary
Constructors Constructor Description AbstractRSAClientService(AbstractClientContainer container, RemoteServiceClientRegistration registration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
callAsync(IRemoteCall call, IRemoteCallListener listener)
Call remote method specified by call parameter asynchronously, and notify specified listener when call starts and completes.Object
callSync(IRemoteCall call)
Call remote method specified by call parameter synchronously.protected AbstractRSAClientService.RSARemoteCall
createRemoteCall(Object proxy, Method method, String methodName, Object[] parameters, long timeout)
protected Callable<IRemoteCallCompleteEvent>
getAsyncCallable(AbstractRSAClientService.RSARemoteCall call)
protected ExecutorService
getExecutorService()
protected ExecutorService
getFutureExecutorService(IRemoteCall call)
protected Callable<Object>
getSyncCallable(AbstractRSAClientService.RSARemoteCall call)
Object
invoke(Object proxy, Method method, Object[] args)
protected Object
invokeAsync(AbstractRSAClientService.RSARemoteCall remoteCall)
Invoke a remote call asynchronously.protected Object
invokeRemoteCall(IRemoteCall call, IRemoteCallable callable)
Invoke remote call.protected Object
invokeSync(AbstractRSAClientService.RSARemoteCall remoteCall)
Invoke a remote call synchronously.-
Methods inherited from class org.eclipse.ecf.remoteservice.client.AbstractClientService
callAsync, callAsync, callAsync, createUriRequest, fireAsync, getCallMethodNameForProxyInvoke, getCallParametersForProxyInvoke, getClientContainer, getInterfaceClassNames, getNextRequestID, getRegistration, getRemoteServiceID, getRemoteServiceReference, handleInvokeException, invokeSync, prepareEndpointAddress, prepareParameters, processResponse
-
Methods inherited from class org.eclipse.ecf.remoteservice.AbstractRemoteService
addAsyncProxyClasses, addRemoteServiceProxyToProxy, callAsync, callAsync, callAsyncWithResult, callAsyncWithTimeout, callAsyncWithTimeout, callCompletableAsync, callFutureAsync, callFutureAsync, callSync, convertInterfaceNameToAsyncInterfaceName, createProxy, createProxy, createRCCE, createRCCEFailure, createRCCESuccess, createRemoteCall, dispose, findAsyncRemoteServiceProxyClass, findAsyncRemoteServiceProxyClass, getAsyncArgs, getAsyncInvokeMethodName, getAsyncRemoteCall, getCallTimeoutForProxyInvoke, getDefaultTimeout, getIFutureExecutor, getProxy, getProxy, getRemoteService, getRemoteServiceProxyCreator, handleInvokeSyncException, handleProxyException, invokeAsync, invokeObject, invokeReturnAsync, isAsync, isInterfaceAsync, isMethodAsync, isOSGIAsync, loadInterfaceClass, loadInterfaceClass, logWarning, setFutureExecutorService, setIFutureExecutor
-
Methods inherited from class org.eclipse.ecf.remoteservice.asyncproxy.AbstractAsyncProxyRemoteService
callFuture, isReturnAsync
-
-
-
-
Constructor Detail
-
AbstractRSAClientService
public AbstractRSAClientService(AbstractClientContainer container, RemoteServiceClientRegistration registration)
-
-
Method Detail
-
invokeRemoteCall
protected Object invokeRemoteCall(IRemoteCall call, IRemoteCallable callable) throws ECFException
Description copied from class:AbstractClientService
Invoke remote call. The implementation of this method should actually make the remote call for the given call and associated callable.- Specified by:
invokeRemoteCall
in classAbstractClientService
- Parameters:
call
- the remote call to invokecallable
- the remote callable to invoke- Returns:
- Object result of remote call
- Throws:
ECFException
- if invoke fails
-
invokeAsync
protected Object invokeAsync(AbstractRSAClientService.RSARemoteCall remoteCall) throws ECFException
Invoke a remote call asynchronously. This method should not block and should return either aIFuture
,Future
, orCompletableFuture
or a CompletableFuture based upon the return type defined in the asynchronous service interface.- Parameters:
remoteCall
- the RSARemoteCall to use to make the asynchronous remote call. Will not benull
.- Returns:
- Object. Should return a non-null instance of
IFuture
,Future
, orCompletableFuture
- Throws:
ECFException
- if async cannot be invoked
-
invokeSync
protected Object invokeSync(AbstractRSAClientService.RSARemoteCall remoteCall) throws ECFException
Invoke a remote call synchronously. This method should block until a value may be returned, or the remote call has failed or timed out.- Parameters:
remoteCall
- the RSARemoteCall to synchronously invoke. Will not benull
.- Returns:
- the result (of appropriate type)
- Throws:
ECFException
- if some exception occurred during invocation
-
createRemoteCall
protected AbstractRSAClientService.RSARemoteCall createRemoteCall(Object proxy, Method method, String methodName, Object[] parameters, long timeout)
-
invoke
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- Specified by:
invoke
in interfaceInvocationHandler
- Overrides:
invoke
in classAbstractRemoteService
- Throws:
Throwable
-
getFutureExecutorService
protected ExecutorService getFutureExecutorService(IRemoteCall call)
- Overrides:
getFutureExecutorService
in classAbstractRemoteService
- Parameters:
call
- the remote call to get the ExecutorService for- Returns:
- ExecutorService
-
callAsync
public void callAsync(IRemoteCall call, IRemoteCallListener listener)
Description copied from interface:IRemoteService
Call remote method specified by call parameter asynchronously, and notify specified listener when call starts and completes.- Specified by:
callAsync
in interfaceIRemoteService
- Overrides:
callAsync
in classAbstractClientService
- 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
.- See Also:
IRemoteCallStartEvent
,IRemoteCallCompleteEvent
-
callSync
public Object callSync(IRemoteCall call) throws ECFException
Description copied from interface:IRemoteService
Call remote method specified by call parameter synchronously.- Specified by:
callSync
in interfaceIRemoteService
- Overrides:
callSync
in classAbstractClientService
- 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
-
getExecutorService
protected ExecutorService getExecutorService()
- Since:
- 8.13
-
getAsyncCallable
protected Callable<IRemoteCallCompleteEvent> getAsyncCallable(AbstractRSAClientService.RSARemoteCall call)
- Since:
- 8.13
-
getSyncCallable
protected Callable<Object> getSyncCallable(AbstractRSAClientService.RSARemoteCall call)
- Since:
- 8.13
-
-