FileDocCategorySizeDatePackage
FutureInvocationHandler.javaAPI DocJBoss 4.2.13896Fri Jul 13 21:02:26 BST 2007org.jboss.aspects.asynch

FutureInvocationHandler

public class FutureInvocationHandler extends org.jboss.aop.proxy.Proxy implements Serializable, org.jboss.aop.instrument.Untransformable, InvocationHandler
An invocation handler for the Future interface using dynamic proxies. It is an alternative to having generated proxies for use with EJB 3, avoiding client relying on javassist in the EJB 3 client proxies
author
Kabir Khan
version
$Revision$

Fields Summary
private static final long
serialVersionUID
private Map
methodMap
Constructors Summary
public FutureInvocationHandler()


    
   
      // FIXME FutureInvocationHandler constructor
      super();
   
Methods Summary
public static java.lang.ObjectcreateFutureProxy(org.jboss.util.id.GUID guid, java.lang.ClassLoader loader, java.lang.Class[] interfaces)

      FutureInvocationHandler ih = new FutureInvocationHandler();
      ih.instanceAdvisor = new ClassInstanceAdvisor();
      ih.mixins = null;
      ih.interfaces = interfaces;
      ih.guid = guid;
      return java.lang.reflect.Proxy.newProxyInstance(loader, interfaces, ih);
   
public java.util.MapgetMethodMap()

      //I don't think we need to populate this for now
      return methodMap;
   
public java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)

      if (method.getName().equals("_getInstanceAdvisor"))
      {
         return _getInstanceAdvisor();
      }
      else if (method.getName().equals("_setInstanceAdvisor") && 
            method.getParameterTypes().length == 1 && method.getParameterTypes()[0].equals(InstanceAdvisor.class))
      {
         _setInstanceAdvisor((InstanceAdvisor)args[0]);
         return null;
      }
      
      Interceptor[] interceptors = instanceAdvisor.getInterceptors();
      long hash = MethodHashing.calculateHash(method);
      MethodInvocation invocation = new MethodInvocation(interceptors, hash, method, method, null);
      invocation.setInstanceResolver(instanceAdvisor.getMetaData()); 
      invocation.setArguments(args); 
      return invocation.invokeNext(); 
   
public java.lang.ObjectwriteReplace()
Override Proxy implementation so we get default behaviour. Reason is to avoid client dependencies on javassist in EJB 3 asynchronous proxies

      return this;