User: hiram   
  Date: 01/01/08 13:57:09

  Modified:    src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
  Log:
  Transactional support added for MDBs.  Message receipt is now
  part of the transaction for a CMT bean with Required transactions.
  Hopefully this did not break anything else with MDBs.
  
  Revision  Changes    Path
  1.6       +17 -4     
jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java
  
  Index: JMSContainerInvoker.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JMSContainerInvoker.java  2001/01/03 08:28:35     1.5
  +++ JMSContainerInvoker.java  2001/01/08 21:57:08     1.6
  @@ -59,7 +59,7 @@
    *      @author Rickard �berg ([EMAIL PROTECTED])
    *           @author <a href="mailto:[EMAIL PROTECTED]">Sebastien 
Alborini</a>
    *      @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
  - *      @version $Revision: 1.5 $
  + *      @version $Revision: 1.6 $
    */
   public class JMSContainerInvoker implements
   ContainerInvoker, XmlLoadable
  @@ -152,7 +152,10 @@
      {
        
          MethodInvocation mi = new MethodInvocation(id, m, args, tx, identity, 
credential);
  -       
  +      
  +        // HC: Transaction are started in the run() of the server session
  +        // since the XAResource of the session might need to be elisted with the TM.
  +        /*
          if (acknowledgeMode == MessageDrivenMetaData.CLIENT_ACKNOWLEDGE_MODE) {
           // CMT with required
           // Create tx 
  @@ -162,6 +165,7 @@
           
           mi.setTransaction(txNew);
          }
  +        */
          
          // Set the right context classloader
          ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  @@ -181,6 +185,14 @@
           2. Or it should be made in the Listener, wich does not have acces
           to the transaction.
           */
  +        /* HC: This has to be done further down the chains since if the bean is
  +        is a CMT with transactions required, the message receipt should be
  +        part of the transaction (in other words the JMS session has to be transacted
  +        and it's commit or rollback will cause the ack or nack of the message)
  +        Refrence the ejb_2_0 spec section :�14.4.7
  +        */
  +
  +        /*
           if (acknowledgeMode == MessageDrivenMetaData.CLIENT_ACKNOWLEDGE_MODE) {     
    
               //DEBUG Logger.debug("Transaction: " + mi.getTransaction());
               
  @@ -203,6 +215,7 @@
                   Logger.error("JMSContainerInvoker: Error in acking CMT Required " + 
ex);
               }
           }
  +        */
           
             Thread.currentThread().setContextClassLoader(oldCl);
          }
  @@ -427,8 +440,8 @@
                               listenerMethod,
                               //argument
                               new Object[] {message},
  -                            //Transaction - where do we get these
  -                            null,
  +                            //Transaction 
  +                                     tm.getTransaction(),
                               //Principal
                               null,
                               //Cred
  
  
  

Reply via email to