FileDocCategorySizeDatePackage
IsLocalInterceptor.javaAPI DocJBoss 4.2.13724Fri Jul 13 20:53:46 BST 2007org.jboss.ejb3.remoting

IsLocalInterceptor

public class IsLocalInterceptor extends Object implements Serializable, org.jboss.aop.advice.Interceptor
Routes the call to the local container, bypassing further client-side interceptors and any remoting layer, if this interceptor was created in this JVM.
author
Bill Burke
author
Brian Stansberry
version
$Revision: 61667 $

Fields Summary
private static final long
serialVersionUID
private static final Logger
log
public static final String
IS_LOCAL
public static final String
IS_LOCAL_EXCEPTION
private static final long
stamp
private long
marshalledStamp
Constructors Summary
Methods Summary
public java.lang.StringgetName()


     
   
      return getClass().getName();
   
public java.lang.Objectinvoke(org.jboss.aop.joinpoint.Invocation invocation)

      if (isLocal())
      {
         Object oid = invocation.getMetaData(Dispatcher.DISPATCHER, Dispatcher.OID);
         Container container = Ejb3Registry.getContainer(oid.toString());
         
         return invokeLocal(invocation, container);
      }
      return invocation.invokeNext();
   
protected java.lang.ObjectinvokeLocal(org.jboss.aop.joinpoint.Invocation invocation, org.jboss.ejb3.Container container)

      Invocation copy = (Invocation) new MarshalledObjectForLocalCalls(invocation).get();
      copy.getMetaData().addMetaData(IS_LOCAL, IS_LOCAL, Boolean.TRUE);
      org.jboss.aop.joinpoint.InvocationResponse response = ((Advisor) container).dynamicInvoke(null, copy);
      Map contextInfo = response.getContextInfo();
      if (contextInfo != null)
      {
         MarshalledObjectForLocalCalls wrappedException = (MarshalledObjectForLocalCalls) response.getContextInfo().get(IS_LOCAL_EXCEPTION);
         if (wrappedException != null)
         {
            throw (Throwable) wrappedException.get();
         }
      }
      invocation.setResponseContextInfo(response.getContextInfo());
      MarshalledObjectForLocalCalls wrapped = (MarshalledObjectForLocalCalls) response.getResponse();
      Object rtn = null;
      if (wrapped != null)
      {
         rtn = wrapped.get();
      }
      return rtn;
   
protected booleanisLocal()

      return stamp == marshalledStamp;