[jboss-cvs] JBossAS SVN: r60193 - trunk/ejb3/src/main/org/jboss/ejb3/remoting.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Feb 2 09:21:11 EST 2007


Author: bdecoste
Date: 2007-02-02 09:21:10 -0500 (Fri, 02 Feb 2007)
New Revision: 60193

Modified:
   trunk/ejb3/src/main/org/jboss/ejb3/remoting/IsLocalInterceptor.java
Log:
fix for case where ejb is identically deployed on multiple nodes and jndi lookup is targeted for remote node - used to always use the local bean

Modified: trunk/ejb3/src/main/org/jboss/ejb3/remoting/IsLocalInterceptor.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/remoting/IsLocalInterceptor.java	2007-02-02 13:13:00 UTC (rev 60192)
+++ trunk/ejb3/src/main/org/jboss/ejb3/remoting/IsLocalInterceptor.java	2007-02-02 14:21:10 UTC (rev 60193)
@@ -28,8 +28,10 @@
 import org.jboss.aop.Advisor;
 import org.jboss.aop.advice.Interceptor;
 import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.logging.Logger;
 import org.jboss.serial.io.MarshalledObjectForLocalCalls;
 import org.jboss.ejb3.Container;
+import org.jboss.ejb3.EJBContainer;
 import org.jboss.ejb3.Ejb3Registry;
 
 /**
@@ -40,8 +42,14 @@
  */
 public class IsLocalInterceptor implements Interceptor, Serializable
 {
+   private static final Logger log = Logger.getLogger(IsLocalInterceptor.class);
+   
    public static final String IS_LOCAL = "IS_LOCAL";
    public static final String IS_LOCAL_EXCEPTION = "IS_LOCAL_EXCEPTION";
+   
+   private static final long stamp = System.currentTimeMillis();
+   private long marshalledStamp = stamp;
+   
    public String getName()
    {
       return getClass().getName();
@@ -49,10 +57,10 @@
 
    public Object invoke(Invocation invocation) throws Throwable
    {
-      Object oid = invocation.getMetaData(Dispatcher.DISPATCHER, Dispatcher.OID);
-      Container container = Ejb3Registry.findContainer(oid.toString());
-      if (container != null)
+      if (isLocal())
       {
+         Object oid = invocation.getMetaData(Dispatcher.DISPATCHER, Dispatcher.OID);
+         Container container = Ejb3Registry.findContainer(oid.toString());
          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);
@@ -76,5 +84,10 @@
       }
       return invocation.invokeNext();
    }
+   
+   private boolean isLocal()
+   {
+      return stamp == marshalledStamp;
+   }
 
 }




More information about the jboss-cvs-commits mailing list