Package org.eclipse.ecf.remoteservice
Class AbstractRemoteService
- java.lang.Object
- 
- org.eclipse.ecf.remoteservice.asyncproxy.AbstractAsyncProxyRemoteService
- 
- org.eclipse.ecf.remoteservice.AbstractRemoteService
 
 
- 
- All Implemented Interfaces:
- InvocationHandler,- IRemoteService
 - Direct Known Subclasses:
- AbstractClientService,- RemoteServiceImpl
 
 public abstract class AbstractRemoteService extends AbstractAsyncProxyRemoteService implements IRemoteService, InvocationHandler Abstract remote service implementation. Clients may subclass to avoid re-implementing methods from IRemoteService.- Since:
- 4.1
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classAbstractRemoteService.AsyncArgsclassAbstractRemoteService.ProxyClassLoader
 - 
Field SummaryFields Modifier and Type Field Description protected static Object[]EMPTY_ARGSprotected ExecutorServicefutureExecutorServiceprotected intfutureExecutorServiceMaxThreadsprotected org.eclipse.equinox.concurrent.future.IExecutoriFutureExecutor
 - 
Constructor SummaryConstructors Constructor Description AbstractRemoteService()
 - 
Method Summary- 
Methods inherited from class org.eclipse.ecf.remoteservice.asyncproxy.AbstractAsyncProxyRemoteServicecallFuture, isReturnAsync
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.eclipse.ecf.remoteservice.IRemoteServicecallAsync, callSync, fireAsync
 
- 
 
- 
- 
- 
Field Detail- 
EMPTY_ARGSprotected static final Object[] EMPTY_ARGS 
 - 
futureExecutorServiceMaxThreadsprotected int futureExecutorServiceMaxThreads - Since:
- 8.2
 
 - 
futureExecutorServiceprotected ExecutorService futureExecutorService - Since:
- 8.2
 
 - 
iFutureExecutorprotected org.eclipse.equinox.concurrent.future.IExecutor iFutureExecutor - Since:
- 8.2
 
 
- 
 - 
Method Detail- 
getFutureExecutorServiceprotected ExecutorService getFutureExecutorService(IRemoteCall call) - Parameters:
- call- the remote call to get the ExecutorService for
- Returns:
- ExecutorService
- Since:
- 8.2
 
 - 
setFutureExecutorServiceprotected void setFutureExecutorService(ExecutorService executorService) - Parameters:
- executorService- the ExecutorService to use for this remote service
- Since:
- 8.2
 
 - 
getIFutureExecutorprotected org.eclipse.equinox.concurrent.future.IExecutor getIFutureExecutor(IRemoteCall call) - Parameters:
- call- the IRemoteCall to get the IExecutor for
- Returns:
- IExecutor the executor to use for the given call instance.
- Since:
- 8.2
 
 - 
setIFutureExecutorprotected void setIFutureExecutor(org.eclipse.equinox.concurrent.future.IExecutor executor) - Parameters:
- executor- executor
- Since:
- 8.2
 
 - 
getInterfaceClassNamesprotected abstract String[] getInterfaceClassNames() 
 - 
getRemoteServiceIDprotected abstract IRemoteServiceID getRemoteServiceID() 
 - 
getRemoteServiceReferenceprotected abstract IRemoteServiceReference getRemoteServiceReference() 
 - 
loadInterfaceClassprotected Class loadInterfaceClass(String className) throws ClassNotFoundException - Throws:
- ClassNotFoundException
 
 - 
loadInterfaceClassprotected Class loadInterfaceClass(ClassLoader cl, String className) throws ClassNotFoundException - Parameters:
- cl- the ClassLoader to load the interface class. Will not be- null
- className- the interface class to load
- Returns:
- Class the class loaded.  Must not be null
- Throws:
- ClassNotFoundException- if class cannot be found
- Since:
- 6.0
 
 - 
getRemoteServiceprotected IRemoteService getRemoteService() 
 - 
getDefaultTimeoutprotected long getDefaultTimeout() 
 - 
callAsyncprotected org.eclipse.equinox.concurrent.future.IFuture callAsync(AbstractAsyncProxyRemoteCall call) - Specified by:
- callAsyncin class- AbstractAsyncProxyRemoteService
 
 - 
callAsyncpublic org.eclipse.equinox.concurrent.future.IFuture callAsync(IRemoteCall call) Description copied from interface:IRemoteServiceCall remote method specified by call parameter asynchronously, and immediately returnIFutureinstance. Returned IFuture will not benull, and allows the caller to retrieve the actual resulting value from the remote call (or exception).- Specified by:
- callAsyncin interface- IRemoteService
- Parameters:
- call- the remote call to make. Must not be- null.
- Returns:
- IFuture the asynchronous result to allow the caller to poll
 for whether the result IFuture.isDone(), and then toIFuture.get()the actual result.
 
 - 
getProxypublic Object getProxy() throws ECFException Description copied from interface:IRemoteServiceGet local proxy for remote interface. The local proxy may then be used to make remote method calls transparently by invoking the local proxy method- Specified by:
- getProxyin interface- IRemoteService
- 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.
 
 - 
addRemoteServiceProxyToProxyprotected void addRemoteServiceProxyToProxy(List classes) - Parameters:
- classes- the interface classes to add to
- Since:
- 6.0
 
 - 
addAsyncProxyClassesprotected List addAsyncProxyClasses(ClassLoader cl, Class[] interfaces) - Parameters:
- cl- ClassLoader to use to add async proxy classes
- interfaces- the Class[] of interface classes
- Returns:
- List the list of interfaces plus any async proxy interface classes.
- Since:
- 8.3
 
 - 
getProxypublic Object getProxy(ClassLoader cl, Class[] interfaces) throws ECFException Description copied from interface:IRemoteServiceGet local proxy for remote interface. The local proxy may then be used to make remote method calls transparently by invoking the local proxy method- Specified by:
- getProxyin interface- IRemoteService
- Parameters:
- cl- ClassLoader to use to create the proxy class. Must not be- null.
- interfaces- array of Class that has the loaded interface classes. Must not be- nulland 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
 
 - 
getRemoteServiceProxyCreatorprotected IRemoteServiceProxyCreator getRemoteServiceProxyCreator() - Returns:
- IRemoteServiceProxyCreator
- Since:
- 8.0
 
 - 
createProxyprotected Object createProxy(ClassLoader cl, Class[] classes) - Parameters:
- cl- ClassLoader for proxy creation
- classes- the Class[] for proxy classes
- Returns:
- Object the proxy implementing the given Class[]
- Since:
- 6.0
 
 - 
findAsyncRemoteServiceProxyClassprotected Class findAsyncRemoteServiceProxyClass(Class c) - Parameters:
- c- Class
- Returns:
- Class
- Since:
- 3.3
 
 - 
findAsyncRemoteServiceProxyClassprotected Class findAsyncRemoteServiceProxyClass(ClassLoader cl, Class c) - Parameters:
- cl- ClassLoader
- c- Class
- Returns:
- Class
- Since:
- 6.0
 
 - 
convertInterfaceNameToAsyncInterfaceNameprotected String convertInterfaceNameToAsyncInterfaceName(String interfaceName) 
 - 
getCallParametersForProxyInvokeprotected Object[] getCallParametersForProxyInvoke(String callMethod, Method proxyMethod, Object[] args) 
 - 
getCallTimeoutForProxyInvokeprotected long getCallTimeoutForProxyInvoke(String callMethod, Method proxyMethod, Object[] args) 
 - 
getCallMethodNameForProxyInvokeprotected String getCallMethodNameForProxyInvoke(Method method, Object[] args) 
 - 
invokeObjectprotected Object invokeObject(Object proxy, Method method, Object[] args) throws Throwable - Throws:
- Throwable
 
 - 
invokeSyncprotected Object invokeSync(IRemoteCall call) throws ECFException - Throws:
- ECFException
 
 - 
isAsyncprotected boolean isAsync(Object proxy, Method method, Object[] args) - Parameters:
- proxy- proxy instance
- method- the java Method invoked
- args- arguments
- Returns:
- true if given proxy/method/args combination represents an async proxy class
- Since:
- 8.3
 
 - 
createRemoteCallprotected IRemoteCall createRemoteCall(String callMethod, Object[] callParameters, long callTimeout) - Parameters:
- callMethod- call method
- callParameters- call parameters
- callTimeout- call timeout
- Returns:
- IRemoteCall remote call created.  Should not be null
- Since:
- 8.3
 
 - 
handleProxyExceptionprotected void handleProxyException(String message, Throwable t) throws ServiceException - Parameters:
- message- message for exception
- t- Throwable to wrap
- Throws:
- ServiceException- thrown if subclasses do not override
- Since:
- 8.6
 
 - 
handleInvokeSyncExceptionprotected void handleInvokeSyncException(String methodName, ECFException e) throws Throwable - Parameters:
- methodName- method name
- e- exception thrown if subclasses do not override
- Throws:
- Throwable- thrown if subclasses to not override
- Since:
- 8.6
 
 - 
invokeReturnAsyncprotected Object invokeReturnAsync(Object proxy, Method method, Object[] args) throws Throwable - Throws:
- Throwable
- Since:
- 8.13
 
 - 
isOSGIAsyncprotected boolean isOSGIAsync() - Since:
- 8.13
 
 - 
isInterfaceAsyncprotected boolean isInterfaceAsync(Class interfaceClass) - Since:
- 8.13
 
 - 
isMethodAsyncprotected boolean isMethodAsync(String methodName) - Since:
- 8.13
 
 - 
invokepublic Object invoke(Object proxy, Method method, Object[] args) throws Throwable - Specified by:
- invokein interface- InvocationHandler
- Throws:
- Throwable
 
 - 
getAsyncRemoteCallprotected RemoteCall getAsyncRemoteCall(String invokeMethodName, Object[] asyncArgs) - Parameters:
- invokeMethodName- invoke method name
- asyncArgs- asynch arguments
- Returns:
- RemoteCall remote call created.  Should not be null
- Since:
- 8.4
 
 - 
invokeAsyncprotected Object invokeAsync(Method method, Object[] args) throws Throwable - Parameters:
- method- java Method invoked
- args- arguments
- Returns:
- Object async future result. Should be of type IFuture, Future, or CompletableFuture
- Throws:
- Throwable- thrown if some problem invoking async
- Since:
- 3.3
 
 - 
callAsyncWithResultprotected Object callAsyncWithResult(IRemoteCall call, IRemoteCallListener listener) - Parameters:
- call- remote call
- listener- remote call listener
- Returns:
- Object will be nullunless subclasses override
- Since:
- 8.2
 
 - 
callCompletableAsyncprotected void callCompletableAsync(AbstractAsyncProxyRemoteCall call, IAsyncProxyCompletable completable) - Specified by:
- callCompletableAsyncin class- AbstractAsyncProxyRemoteService
- Parameters:
- call- abstract remote call
- completable- async proxy completable
- Since:
- 8.4
 
 - 
callFutureAsyncprotected Future callFutureAsync(AbstractAsyncProxyRemoteCall call) - Specified by:
- callFutureAsyncin class- AbstractAsyncProxyRemoteService
- Parameters:
- call- abstract async proxy remote call
- Returns:
- Future future result
- Since:
- 8.4
 
 - 
callFutureAsyncprotected Future callFutureAsync(IRemoteCall call) - Parameters:
- call- remote call
- Returns:
- Future future result
- Since:
- 8.2
 
 - 
getAsyncArgsprotected AbstractRemoteService.AsyncArgs getAsyncArgs(Method method, Object[] args) - Parameters:
- method- method
- args- args
- Returns:
- AsyncArgs async arguments
- Since:
- 3.3
 
 - 
getAsyncInvokeMethodNameprotected String getAsyncInvokeMethodName(Method method) - Parameters:
- method- java method invoked
- Returns:
- String synchronous method name without asynchronous suffix (i.e. fooAsync to foo)
- Since:
- 3.3
 
 - 
callAsyncpublic Future<Object> callAsync(IRemoteCall call, Callable<Object> callable) - Since:
- 8.13
 
 - 
callSyncpublic Object callSync(IRemoteCall call, Callable<Object> callable) throws InterruptedException, ExecutionException, TimeoutException - Throws:
- TimeoutException
- ExecutionException
- InterruptedException
- Since:
- 8.13
 
 - 
disposepublic void dispose() - Since:
- 8.2
 
 - 
callAsyncWithTimeoutprotected Future<Object> callAsyncWithTimeout(IRemoteCall call, Callable<Object> callable) - Since:
- 8.13
 
 - 
createRCCESuccessprotected IRemoteCallCompleteEvent createRCCESuccess(Object result) - Since:
- 8.13
 
 - 
createRCCEFailureprotected IRemoteCallCompleteEvent createRCCEFailure(Throwable e) - Since:
- 8.13
 
 - 
createRCCEprotected IRemoteCallCompleteEvent createRCCE(Object result, Throwable e) - Since:
- 8.13
 
 - 
callAsyncWithTimeoutprotected void callAsyncWithTimeout(IRemoteCall call, Callable<IRemoteCallCompleteEvent> callable, IRemoteCallListener callback) - Since:
- 8.13
 
 
- 
 
-