[jboss-user] [EJB 3.0] - Re: Calling stopDelivery causes a

philipdodds do-not-reply at jboss.com
Tue Jul 14 23:08:24 EDT 2009

Its been a while :) but I finally got a little time to dig into this one a little more, in the end the bit that seems to bite me is the MessageInflowLocalProxy,  when requesting the stopDelivery - messages are continuing to pass through the MDB.  The flow of the requests to stop finally make it to the MessageInflowProxy which will request a release of the proxy - due to a small stack of debugging I was sure I had a transaction in flight and I get to the release method.

  |    protected void release(Object proxy) throws Throwable
  |    {
  |       // We are now released
  |       released.set(true);
  |       if (trace)
  |          log.trace("MessageEndpoint " + getProxyString(proxy) + " release " + Thread.currentThread());
  |       // Tidyup any outstanding delivery
  |       if (oldClassLoader != null)
  |       {
  |          try
  |          {
  |             finish("release", proxy, false);
  |          }
  |          catch (Throwable t)
  |          {
  |             log.warn("Error in release ", t);
  |          }
  |       }
  |    }

What I don't understand is that the oldClassLoader is null which means that the finish didn't get called - looking at that method that means that the finish doesn't get called and the transaction manager didn't get tidied up.

So I continued to dig around to see where the oldClassLoader gets set - it looks like it is done in the before and after,  which would imply that the TransactionDemarcationStrategy in the JmsServerSession needs to be TraditionalXATransactionDemarcationStrategy (since that it checked for) in the onMessage.  I appear to have an XATransactionDemarcationStrategy in place so before and after aren't called.

It looked like in the MessageInflowLocalProxy you look for the oldClassLoader in the delivery method too - if it is null you start a transaction.

  | try
  |       {
  |          // Check for starting a transaction
  |          if (oldClassLoader == null)
  |          {
  |             boolean isTransacted = messageEndpointFactory.isDeliveryTransacted(methodInfo.getAdvisedMethod());
  |             startTransaction("delivery", proxy, container, method, args, isTransacted);
  |          }
  |          return container.localInvoke(methodInfo, args);
  |       }

when you try to release how do you perform the check to ensure that the transaction has completed (when the oldClassLoader is null)?

All this code is pretty new to me so excuse any things that I got patently wrong :)  Any advice or help would be greatly appreciated.



View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4243625#4243625

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4243625

More information about the jboss-user mailing list