[jboss-cvs] JBossAS SVN: r89721 - in branches/JBPAPP_4_2_0_GA_CP/ejb3/src: test/org/jboss/ejb3/test/jbpapp1668 and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jun 3 05:52:50 EDT 2009


Author: wolfc
Date: 2009-06-03 05:52:50 -0400 (Wed, 03 Jun 2009)
New Revision: 89721

Modified:
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/inflow/JBossMessageEndpointFactory.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/inflow/MessageInflowLocalProxy.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp1668/AbstractTXMDB.java
Log:
JBPAPP-1668: fixed isDeliveryTransacted method

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/inflow/JBossMessageEndpointFactory.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/inflow/JBossMessageEndpointFactory.java	2009-06-03 09:44:13 UTC (rev 89720)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/inflow/JBossMessageEndpointFactory.java	2009-06-03 09:52:50 UTC (rev 89721)
@@ -26,12 +26,11 @@
 import java.util.Collection;
 import java.util.HashMap;
 
-import javax.ejb.TransactionManagementType;
 import javax.ejb.TransactionAttribute;
 import javax.ejb.TransactionAttributeType;
+import javax.ejb.TransactionManagementType;
+import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
 import javax.resource.spi.ActivationSpec;
 import javax.resource.spi.UnavailableException;
 import javax.resource.spi.endpoint.MessageEndpoint;
@@ -41,11 +40,11 @@
 import org.jboss.deployment.DeploymentException;
 import org.jboss.ejb3.Container;
 import org.jboss.ejb3.KernelAbstractionFactory;
+import org.jboss.ejb3.mdb.MessagingContainer;
 import org.jboss.ejb3.tx.TxUtil;
-import org.jboss.ejb3.mdb.MessagingContainer;
+import org.jboss.logging.Logger;
 import org.jboss.metadata.ActivationConfigPropertyMetaData;
 import org.jboss.mx.util.JMXExceptionDecoder;
-import org.jboss.logging.Logger;
 
 import EDU.oswego.cs.dl.util.concurrent.SynchronizedInt;
 
@@ -186,8 +185,10 @@
       TransactionManagementType mtype = TxUtil.getTransactionManagementType(container);
       if (mtype == javax.ejb.TransactionManagementType.BEAN) return false;
 
-
-      TransactionAttribute attr = (TransactionAttribute)container.resolveAnnotation(method, TransactionAttribute.class);
+      // JBPAPP-1668: the method can be called by anybody using the interface method (== unadvised)
+      Method advisedMethod = container.getMethodInfo(method).getAdvisedMethod();
+      
+      TransactionAttribute attr = (TransactionAttribute)container.resolveAnnotation(advisedMethod, TransactionAttribute.class);
       if (attr == null)
       {
          attr =(TransactionAttribute)container.resolveAnnotation(TransactionAttribute.class);

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/inflow/MessageInflowLocalProxy.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/inflow/MessageInflowLocalProxy.java	2009-06-03 09:44:13 UTC (rev 89720)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/mdb/inflow/MessageInflowLocalProxy.java	2009-06-03 09:52:50 UTC (rev 89721)
@@ -21,8 +21,8 @@
  */
 package org.jboss.ejb3.mdb.inflow;
 
+import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
-import java.lang.reflect.InvocationHandler;
 
 import javax.resource.ResourceException;
 import javax.resource.spi.endpoint.MessageEndpointFactory;
@@ -31,11 +31,10 @@
 import javax.transaction.TransactionManager;
 import javax.transaction.xa.XAResource;
 
+import org.jboss.aop.MethodInfo;
 import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.aop.joinpoint.MethodInvocation;
-import org.jboss.aop.MethodInfo;
 import org.jboss.ejb3.mdb.MessagingContainer;
-import org.jboss.ejb3.mdb.MDB;
 import org.jboss.ejb3.tx.TxUtil;
 import org.jboss.logging.Logger;
 
@@ -49,6 +48,26 @@
 {
    private static final Logger log = Logger.getLogger(MessageInflowLocalProxy.class);
    
+   private static final Method METHOD_TO_STRING;
+   
+   static
+   {
+      try
+      {
+         //METHOD_EQUALS = Object.class.getDeclaredMethod("equals", Object.class);
+         //METHOD_HASH_CODE = Object.class.getDeclaredMethod("hashCode");
+         METHOD_TO_STRING = Object.class.getDeclaredMethod("toString");
+      }
+      catch (SecurityException e)
+      {
+         throw new RuntimeException(e);
+      }
+      catch (NoSuchMethodException e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+   
    /** The key for the factory */
    public static final String MESSAGE_ENDPOINT_FACTORY = "MessageEndpoint.Factory";
 
@@ -104,7 +123,10 @@
 
    public Object invoke(Object proxy, Method method, Object[] args)
            throws Throwable
-   {   
+   {
+      if(method.equals(METHOD_TO_STRING))
+         return getProxyString(proxy);
+      
       // Are we still useable?
       if (released.get())
          throw new IllegalStateException("This message endpoint + " + getProxyString(proxy) + " has been released");
@@ -198,8 +220,7 @@
       try
       {
          // Is the delivery transacted?
-         MethodInfo methodInfo = container.getMethodInfo((Method)args[0]);
-         boolean isTransacted = messageEndpointFactory.isDeliveryTransacted(methodInfo.getAdvisedMethod());
+         boolean isTransacted = messageEndpointFactory.isDeliveryTransacted((Method) args[0]);
 
          startTransaction("beforeDelivery", proxy, container, method, args, isTransacted);
       }
@@ -262,7 +283,7 @@
          // Check for starting a transaction
          if (oldClassLoader == null)
          {
-            boolean isTransacted = messageEndpointFactory.isDeliveryTransacted(methodInfo.getAdvisedMethod());
+            boolean isTransacted = messageEndpointFactory.isDeliveryTransacted(method);
             startTransaction("delivery", proxy, container, method, args, isTransacted);
          }
          return container.localInvoke(methodInfo, args);

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp1668/AbstractTXMDB.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp1668/AbstractTXMDB.java	2009-06-03 09:44:13 UTC (rev 89720)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp1668/AbstractTXMDB.java	2009-06-03 09:52:50 UTC (rev 89721)
@@ -53,13 +53,13 @@
          {
             int status = tm.getStatus();
             
-            log.info("Transaction status " + status);
+            log.info("Transaction status for " + this + " is " + status);
             
             sendReply(destination, status);
          }
          catch(SystemException e)
          {
-            log.warn("Transaction status failed", e);
+            log.warn("Transaction status for " + this + " failed", e);
             sendReply(destination, e);
          }
       }




More information about the jboss-cvs-commits mailing list