3 Replies Latest reply on Mar 11, 2009 1:13 PM by timfox

    XAResource.isSameRM

    clebert.suconic

      The following test is failing:

      Shouldn't session1.isSameRM(session2) return true, since they refer to the same server?

       public void testIsSameRM() throws Exception
       {
       ClientSession session1 = factory.createSession(true, false, false);
       ClientSession session2 = factory.createSession(true, false, false);
      
       assertTrue(session1.isSameRM(session2));
      
       session1.close();
       session2.close();
       }
      
      



      By consequence of that, the following JMS test that I wrote is also failing:


      public void testIsSamRM() throws Exception
       {
       XAConnection conn = null;
      
       conn = xacf.createXAConnection();
      
       //Create a session
       XASession sess1 = conn.createXASession();
       XAResource res1 = sess1.getXAResource();
      
       //Create a session
       XASession sess2 = conn.createXASession();
       XAResource res2 = sess2.getXAResource();
      
      
       assertTrue(res1.isSameRM(res2));
      
       }
      



      So, isSameRM is basically aways returning false, unless you compare res1 against itself..


      BTW: (This failing test was actually the reason I was having a hard time understanding why JOIN was not being called).



        • 1. Re: XAResource.isSameRM
          jmesnil

          Given how ClientSessionImpl.isSameRM() is written, it will return true only if both sessions share the same *remoting connection to the server*.

          If you create 2 sessions, they will have separate remoting connections and won't be considered as the same RM by the TM (it thinks JBM allows 8 remoting connection to be created before sharing them)

          • 2. Re: XAResource.isSameRM
            jmesnil

             

            "jmesnil" wrote:
            (it thinks JBM allows 8 remoting connection to be created before sharing them)


            I meant: *I think ...*

            • 3. Re: XAResource.isSameRM
              timfox

              Yes, this was from the old days when we had just a single remoting connection to each server,

              To correct it, need to check whether the connection managers are the same, not the remoting connections.