org.eclipse.ecf.remoteservice
Class AbstractRemoteService
java.lang.Object
org.eclipse.ecf.remoteservice.asyncproxy.AbstractAsyncProxyRemoteService
org.eclipse.ecf.remoteservice.AbstractRemoteService
- All Implemented Interfaces:
- java.lang.reflect.InvocationHandler, IRemoteService
- Direct Known Subclasses:
- AbstractClientService, RemoteServiceImpl
public abstract class AbstractRemoteService
- extends AbstractAsyncProxyRemoteService
- implements IRemoteService, java.lang.reflect.InvocationHandler
Abstract remote service implementation. Clients may subclass to avoid re-implementing
methods from IRemoteService.
- Since:
- 4.1
|
Method Summary |
protected java.util.List |
addAsyncProxyClasses(java.lang.ClassLoader cl,
java.lang.Class[] interfaces)
|
protected void |
addRemoteServiceProxyToProxy(java.util.List classes)
|
protected org.eclipse.equinox.concurrent.future.IFuture |
callAsync(AbstractAsyncProxyRemoteCall call)
|
org.eclipse.equinox.concurrent.future.IFuture |
callAsync(IRemoteCall call)
Call remote method specified by call parameter asynchronously, and immediately
return IFuture instance. |
protected java.lang.Object |
callAsyncWithResult(IRemoteCall call,
IRemoteCallListener listener)
|
protected void |
callCompletableAsync(AbstractAsyncProxyRemoteCall call,
IAsyncProxyCompletable completable)
|
protected java.util.concurrent.Future |
callFutureAsync(AbstractAsyncProxyRemoteCall call)
|
protected java.util.concurrent.Future |
callFutureAsync(IRemoteCall call)
|
protected java.lang.String |
convertInterfaceNameToAsyncInterfaceName(java.lang.String interfaceName)
|
protected java.lang.Object |
createProxy(java.lang.Class[] classes)
|
protected java.lang.Object |
createProxy(java.lang.ClassLoader cl,
java.lang.Class[] classes)
|
protected IRemoteCall |
createRemoteCall(java.lang.String callMethod,
java.lang.Object[] callParameters,
long callTimeout)
|
void |
dispose()
|
protected java.lang.Class |
findAsyncRemoteServiceProxyClass(java.lang.Class c)
|
protected java.lang.Class |
findAsyncRemoteServiceProxyClass(java.lang.ClassLoader cl,
java.lang.Class c)
|
protected AbstractRemoteService.AsyncArgs |
getAsyncArgs(java.lang.reflect.Method method,
java.lang.Object[] args)
|
protected java.lang.String |
getAsyncInvokeMethodName(java.lang.reflect.Method method)
|
protected RemoteCall |
getAsyncRemoteCall(java.lang.String invokeMethodName,
java.lang.Object[] asyncArgs)
|
protected java.lang.String |
getCallMethodNameForProxyInvoke(java.lang.reflect.Method method,
java.lang.Object[] args)
|
protected java.lang.Object[] |
getCallParametersForProxyInvoke(java.lang.String callMethod,
java.lang.reflect.Method proxyMethod,
java.lang.Object[] args)
|
protected long |
getCallTimeoutForProxyInvoke(java.lang.String callMethod,
java.lang.reflect.Method proxyMethod,
java.lang.Object[] args)
|
protected long |
getDefaultTimeout()
|
protected java.util.concurrent.ExecutorService |
getFutureExecutorService(IRemoteCall call)
|
protected org.eclipse.equinox.concurrent.future.IExecutor |
getIFutureExecutor(IRemoteCall call)
|
protected abstract java.lang.String[] |
getInterfaceClassNames()
|
java.lang.Object |
getProxy()
Get local proxy for remote interface. |
java.lang.Object |
getProxy(java.lang.ClassLoader cl,
java.lang.Class[] interfaces)
Get local proxy for remote interface. |
protected IRemoteService |
getRemoteService()
|
protected abstract IRemoteServiceID |
getRemoteServiceID()
|
protected IRemoteServiceProxyCreator |
getRemoteServiceProxyCreator()
|
protected abstract IRemoteServiceReference |
getRemoteServiceReference()
|
protected void |
handleInvokeSyncException(java.lang.String methodName,
ECFException e)
|
protected void |
handleProxyException(java.lang.String message,
java.lang.Throwable t)
|
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
|
protected java.lang.Object |
invokeAsync(java.lang.reflect.Method method,
java.lang.Object[] args)
|
protected java.lang.Object |
invokeObject(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
|
protected java.lang.Object |
invokeSync(IRemoteCall call)
|
protected boolean |
isAsync(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
|
protected java.lang.Class |
loadInterfaceClass(java.lang.ClassLoader cl,
java.lang.String className)
|
protected java.lang.Class |
loadInterfaceClass(java.lang.String className)
|
protected void |
logWarning(java.lang.String string,
java.lang.Throwable e)
|
protected void |
setFutureExecutorService(java.util.concurrent.ExecutorService executorService)
|
protected void |
setIFutureExecutor(org.eclipse.equinox.concurrent.future.IExecutor executor)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EMPTY_ARGS
protected static final java.lang.Object[] EMPTY_ARGS
futureExecutorServiceMaxThreads
protected int futureExecutorServiceMaxThreads
- Since:
- 8.2
futureExecutorService
protected java.util.concurrent.ExecutorService futureExecutorService
- Since:
- 8.2
iFutureExecutor
protected org.eclipse.equinox.concurrent.future.IExecutor iFutureExecutor
- Since:
- 8.2
AbstractRemoteService
public AbstractRemoteService()
getFutureExecutorService
protected java.util.concurrent.ExecutorService getFutureExecutorService(IRemoteCall call)
- Since:
- 8.2
setFutureExecutorService
protected void setFutureExecutorService(java.util.concurrent.ExecutorService executorService)
- Since:
- 8.2
getIFutureExecutor
protected org.eclipse.equinox.concurrent.future.IExecutor getIFutureExecutor(IRemoteCall call)
- Since:
- 8.2
setIFutureExecutor
protected void setIFutureExecutor(org.eclipse.equinox.concurrent.future.IExecutor executor)
- Since:
- 8.2
getInterfaceClassNames
protected abstract java.lang.String[] getInterfaceClassNames()
getRemoteServiceID
protected abstract IRemoteServiceID getRemoteServiceID()
getRemoteServiceReference
protected abstract IRemoteServiceReference getRemoteServiceReference()
loadInterfaceClass
protected java.lang.Class loadInterfaceClass(java.lang.String className)
throws java.lang.ClassNotFoundException
- Throws:
java.lang.ClassNotFoundException
loadInterfaceClass
protected java.lang.Class loadInterfaceClass(java.lang.ClassLoader cl,
java.lang.String className)
throws java.lang.ClassNotFoundException
- Throws:
java.lang.ClassNotFoundException- Since:
- 6.0
getRemoteService
protected IRemoteService getRemoteService()
getDefaultTimeout
protected long getDefaultTimeout()
callAsync
protected org.eclipse.equinox.concurrent.future.IFuture callAsync(AbstractAsyncProxyRemoteCall call)
- Specified by:
callAsync in class AbstractAsyncProxyRemoteService
callAsync
public org.eclipse.equinox.concurrent.future.IFuture callAsync(IRemoteCall call)
- Description copied from interface:
IRemoteService
- Call remote method specified by call parameter asynchronously, and immediately
return
IFuture instance. Returned IFuture will not be null,
and allows the caller to retrieve the actual resulting value from the remote call
(or exception).
- Specified by:
callAsync in 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 to IFuture.get()
the actual result.
getProxy
public java.lang.Object getProxy()
throws ECFException
- Description copied from interface:
IRemoteService
- 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
- Specified by:
getProxy in 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.
addRemoteServiceProxyToProxy
protected void addRemoteServiceProxyToProxy(java.util.List classes)
- Since:
- 6.0
addAsyncProxyClasses
protected java.util.List addAsyncProxyClasses(java.lang.ClassLoader cl,
java.lang.Class[] interfaces)
- Since:
- 8.3
getProxy
public java.lang.Object getProxy(java.lang.ClassLoader cl,
java.lang.Class[] interfaces)
throws ECFException
- Description copied from interface:
IRemoteService
- 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
- Specified by:
getProxy in 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 null 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
getRemoteServiceProxyCreator
protected IRemoteServiceProxyCreator getRemoteServiceProxyCreator()
- Since:
- 8.0
createProxy
protected java.lang.Object createProxy(java.lang.ClassLoader cl,
java.lang.Class[] classes)
- Since:
- 6.0
createProxy
protected java.lang.Object createProxy(java.lang.Class[] classes)
findAsyncRemoteServiceProxyClass
protected java.lang.Class findAsyncRemoteServiceProxyClass(java.lang.Class c)
- Since:
- 3.3
findAsyncRemoteServiceProxyClass
protected java.lang.Class findAsyncRemoteServiceProxyClass(java.lang.ClassLoader cl,
java.lang.Class c)
- Since:
- 6.0
convertInterfaceNameToAsyncInterfaceName
protected java.lang.String convertInterfaceNameToAsyncInterfaceName(java.lang.String interfaceName)
getCallParametersForProxyInvoke
protected java.lang.Object[] getCallParametersForProxyInvoke(java.lang.String callMethod,
java.lang.reflect.Method proxyMethod,
java.lang.Object[] args)
getCallTimeoutForProxyInvoke
protected long getCallTimeoutForProxyInvoke(java.lang.String callMethod,
java.lang.reflect.Method proxyMethod,
java.lang.Object[] args)
getCallMethodNameForProxyInvoke
protected java.lang.String getCallMethodNameForProxyInvoke(java.lang.reflect.Method method,
java.lang.Object[] args)
invokeObject
protected java.lang.Object invokeObject(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
throws java.lang.Throwable
- Throws:
java.lang.Throwable
invokeSync
protected java.lang.Object invokeSync(IRemoteCall call)
throws ECFException
- Throws:
ECFException
isAsync
protected boolean isAsync(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
- Since:
- 8.3
createRemoteCall
protected IRemoteCall createRemoteCall(java.lang.String callMethod,
java.lang.Object[] callParameters,
long callTimeout)
- Since:
- 8.3
handleProxyException
protected void handleProxyException(java.lang.String message,
java.lang.Throwable t)
throws org.osgi.framework.ServiceException
- Throws:
org.osgi.framework.ServiceException- Since:
- 8.6
handleInvokeSyncException
protected void handleInvokeSyncException(java.lang.String methodName,
ECFException e)
throws java.lang.Throwable
- Throws:
java.lang.Throwable- Since:
- 8.6
invoke
public java.lang.Object invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
throws java.lang.Throwable
- Specified by:
invoke in interface java.lang.reflect.InvocationHandler
- Throws:
java.lang.Throwable
getAsyncRemoteCall
protected RemoteCall getAsyncRemoteCall(java.lang.String invokeMethodName,
java.lang.Object[] asyncArgs)
- Since:
- 8.4
invokeAsync
protected java.lang.Object invokeAsync(java.lang.reflect.Method method,
java.lang.Object[] args)
throws java.lang.Throwable
- Throws:
java.lang.Throwable- Since:
- 3.3
callAsyncWithResult
protected java.lang.Object callAsyncWithResult(IRemoteCall call,
IRemoteCallListener listener)
- Since:
- 8.2
callCompletableAsync
protected void callCompletableAsync(AbstractAsyncProxyRemoteCall call,
IAsyncProxyCompletable completable)
- Specified by:
callCompletableAsync in class AbstractAsyncProxyRemoteService
- Since:
- 8.4
callFutureAsync
protected java.util.concurrent.Future callFutureAsync(AbstractAsyncProxyRemoteCall call)
- Specified by:
callFutureAsync in class AbstractAsyncProxyRemoteService
- Since:
- 8.4
callFutureAsync
protected java.util.concurrent.Future callFutureAsync(IRemoteCall call)
- Since:
- 8.2
getAsyncArgs
protected AbstractRemoteService.AsyncArgs getAsyncArgs(java.lang.reflect.Method method,
java.lang.Object[] args)
- Since:
- 3.3
getAsyncInvokeMethodName
protected java.lang.String getAsyncInvokeMethodName(java.lang.reflect.Method method)
- Since:
- 3.3
logWarning
protected void logWarning(java.lang.String string,
java.lang.Throwable e)
dispose
public void dispose()
- Since:
- 8.2