FileDocCategorySizeDatePackage
ForwardingInterceptor.javaAPI DocJBoss 4.2.12759Fri Jul 13 21:02:26 BST 2007org.jboss.aspects.remoting

ForwardingInterceptor

public class ForwardingInterceptor extends Object implements org.jboss.aop.advice.Interceptor, ClusterConstants
Checks to see if this object is local in VM
author
Bill Burke
version
$Revision: 57186 $

Fields Summary
private final Object
obj
Constructors Summary
public ForwardingInterceptor(Object obj)

      this.obj = obj;
   
Methods Summary
public java.lang.StringgetName()

 return "ForwardingInterceptor"; 
public java.lang.Objectinvoke(org.jboss.aop.joinpoint.Invocation invocation)

      if (invocation instanceof MethodInvocation)
      {
         // For non-advised methods, we can only do public method invocations
         org.jboss.aop.joinpoint.MethodInvocation methodInvocation = (org.jboss.aop.joinpoint.MethodInvocation)invocation;
         long methodHash = methodInvocation.getMethodHash();
         HashMap methodMap = ClassProxyFactory.getMethodMap(obj.getClass());
         MethodPersistentReference ref = (MethodPersistentReference)methodMap.get(new Long(methodHash));
         Method method = (Method)ref.get();
         Object[] args = methodInvocation.getArguments();
         try
         {
            return method.invoke(obj, args);
         }
         catch (InvocationTargetException ex)
         {
            throw ex.getTargetException();
         }
      }
      else
      {
         throw new RuntimeException("field invocations not implemented");
      }