Methods Summary |
---|
public java.lang.Object | execute(org.jboss.aop.joinpoint.MethodInvocation invocation)
RemotableFuture future = executor.execute(invocation);
InvokerLocator locator = (InvokerLocator) invocation.getMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR);
// this is a remote invocation so just stuff the future within the response
if (locator != null)
{
setupRemoteFuture(invocation, future, locator);
}
else
{
setupLocalFuture(invocation, future);
}
return NullOrZero.nullOrZero(invocation.getMethod().getReturnType());
|
protected boolean | generateProxy()Default behaviour is to generate a proxy using aop.
This can be overridden, e.g. by the EJB3 AsynchronousInterceptor to avoid dependencies on javassist for EJB3 clients
return generateFutureProxy;
|
public org.jboss.aop.Advisor | getAdvisor()
return advisor;
|
public void | setAdvisor(org.jboss.aop.Advisor advisor)
this.advisor = advisor;
Class executorClass = null;
AsynchExecutor executorAnnotation = (AsynchExecutor) advisor.resolveAnnotation(AsynchExecutor.class);
if (executorAnnotation == null)
{
executorClass = ThreadPoolExecutor.class;
}
else
{
executorClass = executorAnnotation.value();
}
try
{
executor = (ExecutorAbstraction) executorClass.newInstance();
}
catch (InstantiationException e)
{
throw new RuntimeException(e);
}
catch (IllegalAccessException e)
{
throw new RuntimeException(e);
}
executor.setAdvisor(advisor);
|
public void | setGenerateDynamicProxy(boolean gen)
this.generateFutureProxy = gen;
|
protected void | setupLocalFuture(org.jboss.aop.joinpoint.MethodInvocation invocation, Future future)
FutureHolder provider = (FutureHolder) invocation.getTargetObject();
provider.setFuture(future);
invocation.addResponseAttachment(FUTURE, future);
|
protected void | setupRemoteFuture(org.jboss.aop.joinpoint.MethodInvocation invocation, RemotableFuture future, org.jboss.remoting.InvokerLocator locator)
GUID futureGUID = new GUID();
Dispatcher.singleton.registerTarget(futureGUID, future);
InstanceAdvised ia = (generateProxy()) ?
ProxyFactory.createInterfaceProxy(futureClassGUID, Future.class.getClassLoader(), futureIntf) :
(InstanceAdvised)FutureInvocationHandler.createFutureProxy(futureClassGUID, Future.class.getClassLoader(), futureDynamicIntf);
Remoting.makeRemotable(ia, locator, futureGUID);
future.setRemoteObjectID(futureGUID);
invocation.addResponseAttachment(FUTURE, ia);
|