public abstract class AbstractRemoteService extends AbstractAsyncProxyRemoteService implements IRemoteService, java.lang.reflect.InvocationHandler
Modifier and Type | Class and Description |
---|---|
class |
AbstractRemoteService.AsyncArgs |
class |
AbstractRemoteService.ProxyClassLoader |
Modifier and Type | Field and Description |
---|---|
protected static java.lang.Object[] |
EMPTY_ARGS |
protected java.util.concurrent.ExecutorService |
futureExecutorService |
protected int |
futureExecutorServiceMaxThreads |
protected org.eclipse.equinox.concurrent.future.IExecutor |
iFutureExecutor |
Constructor and Description |
---|
AbstractRemoteService() |
Modifier and Type | Method and Description |
---|---|
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) |
callFuture
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
callAsync, callSync, fireAsync
protected static final java.lang.Object[] EMPTY_ARGS
protected int futureExecutorServiceMaxThreads
protected java.util.concurrent.ExecutorService futureExecutorService
protected org.eclipse.equinox.concurrent.future.IExecutor iFutureExecutor
protected java.util.concurrent.ExecutorService getFutureExecutorService(IRemoteCall call)
call
- the remote call to get the ExecutorService forprotected void setFutureExecutorService(java.util.concurrent.ExecutorService executorService)
executorService
- the ExecutorService to use for this remote serviceprotected org.eclipse.equinox.concurrent.future.IExecutor getIFutureExecutor(IRemoteCall call)
call
- the IRemoteCall to get the IExecutor forprotected void setIFutureExecutor(org.eclipse.equinox.concurrent.future.IExecutor executor)
executor
- executorprotected abstract java.lang.String[] getInterfaceClassNames()
protected abstract IRemoteServiceID getRemoteServiceID()
protected abstract IRemoteServiceReference getRemoteServiceReference()
protected java.lang.Class loadInterfaceClass(java.lang.String className) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
protected java.lang.Class loadInterfaceClass(java.lang.ClassLoader cl, java.lang.String className) throws java.lang.ClassNotFoundException
cl
- the ClassLoader to load the interface class. Will not be null
className
- the interface class to loadnull
java.lang.ClassNotFoundException
- if class cannot be foundprotected IRemoteService getRemoteService()
protected long getDefaultTimeout()
protected org.eclipse.equinox.concurrent.future.IFuture callAsync(AbstractAsyncProxyRemoteCall call)
callAsync
in class AbstractAsyncProxyRemoteService
public org.eclipse.equinox.concurrent.future.IFuture callAsync(IRemoteCall call)
IRemoteService
IFuture
instance. Returned IFuture will not be null
,
and allows the caller to retrieve the actual resulting value from the remote call
(or exception).callAsync
in interface IRemoteService
call
- the remote call to make. Must not be null
.IFuture.isDone()
, and then to IFuture.get()
the actual result.public java.lang.Object getProxy() throws ECFException
IRemoteService
getProxy
in interface IRemoteService
null
.ECFException
- If some problem in creating the proxy. The underlying problem is
conveyed in the nested exception.protected void addRemoteServiceProxyToProxy(java.util.List classes)
classes
- the interface classes to add toprotected java.util.List addAsyncProxyClasses(java.lang.ClassLoader cl, java.lang.Class[] interfaces)
cl
- ClassLoader to use to add async proxy classesinterfaces
- the Class[] of interface classespublic java.lang.Object getProxy(java.lang.ClassLoader cl, java.lang.Class[] interfaces) throws ECFException
IRemoteService
getProxy
in interface IRemoteService
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.null
ECFException
- If some problem in creating the proxy. The underlying problem is
conveyed in the nested exception.protected IRemoteServiceProxyCreator getRemoteServiceProxyCreator()
protected java.lang.Object createProxy(java.lang.ClassLoader cl, java.lang.Class[] classes)
cl
- ClassLoader for proxy creationclasses
- the Class[] for proxy classesprotected java.lang.Object createProxy(java.lang.Class[] classes)
protected java.lang.Class findAsyncRemoteServiceProxyClass(java.lang.Class c)
c
- Classprotected java.lang.Class findAsyncRemoteServiceProxyClass(java.lang.ClassLoader cl, java.lang.Class c)
cl
- ClassLoaderc
- Classprotected java.lang.String convertInterfaceNameToAsyncInterfaceName(java.lang.String interfaceName)
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 java.lang.String getCallMethodNameForProxyInvoke(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) throws java.lang.Throwable
java.lang.Throwable
protected java.lang.Object invokeSync(IRemoteCall call) throws ECFException
ECFException
protected boolean isAsync(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
proxy
- proxy instancemethod
- the java Method invokedargs
- argumentsprotected IRemoteCall createRemoteCall(java.lang.String callMethod, java.lang.Object[] callParameters, long callTimeout)
callMethod
- call methodcallParameters
- call parameterscallTimeout
- call timeoutnull
protected void handleProxyException(java.lang.String message, java.lang.Throwable t) throws org.osgi.framework.ServiceException
message
- message for exceptiont
- Throwable to wraporg.osgi.framework.ServiceException
- thrown if subclasses do not overrideprotected void handleInvokeSyncException(java.lang.String methodName, ECFException e) throws java.lang.Throwable
methodName
- method namee
- exception thrown if subclasses do not overridejava.lang.Throwable
- thrown if subclasses to not overridepublic java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
invoke
in interface java.lang.reflect.InvocationHandler
java.lang.Throwable
protected RemoteCall getAsyncRemoteCall(java.lang.String invokeMethodName, java.lang.Object[] asyncArgs)
invokeMethodName
- invoke method nameasyncArgs
- asynch argumentsnull
protected java.lang.Object invokeAsync(java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
method
- java Method invokedargs
- argumentsjava.lang.Throwable
- thrown if some problem invoking asyncprotected java.lang.Object callAsyncWithResult(IRemoteCall call, IRemoteCallListener listener)
call
- remote calllistener
- remote call listenernull
unless subclasses overrideprotected void callCompletableAsync(AbstractAsyncProxyRemoteCall call, IAsyncProxyCompletable completable)
callCompletableAsync
in class AbstractAsyncProxyRemoteService
call
- abstract remote callcompletable
- async proxy completableprotected java.util.concurrent.Future callFutureAsync(AbstractAsyncProxyRemoteCall call)
callFutureAsync
in class AbstractAsyncProxyRemoteService
call
- abstract async proxy remote callprotected java.util.concurrent.Future callFutureAsync(IRemoteCall call)
call
- remote callprotected AbstractRemoteService.AsyncArgs getAsyncArgs(java.lang.reflect.Method method, java.lang.Object[] args)
method
- methodargs
- argsprotected java.lang.String getAsyncInvokeMethodName(java.lang.reflect.Method method)
method
- java method invokedprotected void logWarning(java.lang.String string, java.lang.Throwable e)
public void dispose()