2 Replies Latest reply on Aug 23, 2003 10:49 AM by adrian.brock

    global TX not consistently propagated to XA resource adapter

    nbarratt

      I've got a resource adapter in development on JBoss 3.2.1 that needs to support XA transactions. I'm calling into the adapter from a CMT session bean with trans-attribute Required. I acquire a reference to the connection when the bean is created or activated, and close it when the bean is passivated or removed. It appears that the global TX is correctly propagate on the first call into the bean, when the bean is initially created (and thus the connection established), but not on subsequent calls, where the bean (and thus connection) or merely used.

      Is this correct behavior? I was under the impression that RA connection lifetimes were expected to be long and that the underlying ManagedConnection would have its associated XAResource's start(...) and end(...) methods called as necessary.

      Additionally, XAResource.end(..) is getting called twice: once with TMSUSPEND and once with TMSUCCESS.

        • 1. Re: global TX not consistently propagated to XA resource ada
          christian.harms

          We're doing similar stuff but we're acquiring a reference to the connection using the connection factory each time a bean method is called. With that we see calls to start, end, etc. each time.
          It would be interesting to see (extracts of) your session beans source code to compare the handling.

          For my understanding end(TMRESUME) is called when a connection is closed (in other conditions as well?); end(TMSUCCESS) is called when the transaction is ended by the container.
          See my post http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t= on XA-Handling as well.

          • 2. Re: global TX not consistently propagated to XA resource ada

            This is expected behaviour.
            Read the spec.
            activate and passivate are invoked in an unspecified
            transaction context

            JBoss has an attribute in transaction-service.xml where
            you can get spec defined behaviour for connection
            association/disassociation.

            The spec behaviour confuses most developers
            (and leads to connection pool leaks), so the default behaviour
            in jboss is to warn people about unclosed connections and
            close them.

            The TMSUSPEND is the close(), the TMSUCCESS is the
            commit() see the other thread.

            Regards,
            Adrian