Qpid
  1. Qpid
  2. QPID-3263

Java (org.apache.qpid.client) XAResourceImpl always returns false for isSameRM

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.11
    • Fix Version/s: 0.14
    • Component/s: Java Client
    • Labels:
      None
    • Environment:

      All OS/hardware platforms as well as current brokers.

      Description

      The isSameRM method of org.apache.qpid.client.XAResourceImpl always returns
      false.

      The javadoc for isSameRM says ..

      "This method is called to determine if the resource manager instance
      represented by the target object is the same as the resource manager instance
      represented by the parameter xares ."

      which means isSameRM has to return true when invoked with identical objects
      (Java identity). Clearly, these two XA resources are backed by the same
      resource manager.

      //xaResource1 == xaResource2
      XAResource xaResource1 = jmsXAResource;
      XAResource xaResource2 = jmsXAResource;

      // xaResource1.isSameRM(xaResource2) should be true

      Because the Qpid implementation always returns false, it affects resource
      enlistment/delistment.

      The source code (lines 213 - 217) of org.apache.qpid.client.XAResourceImpl
      suggests that this method has not been fully completed.

      public boolean isSameRM(XAResource xaResource) throws XAException

      { // TODO : get the server identity of xaResource and compare it with our own one return false; }
      1. qpid3263.patch
        9 kB
        Weston M. Price
      2. MRG-00471937.zip
        3 kB
        Weston M. Price

        Activity

        Rajith Attapattu made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 0.14 [ 12316855 ]
        Fix Version/s 0.11 [ 12316272 ]
        Resolution Fixed [ 1 ]
        Hide
        Rajith Attapattu added a comment -

        Applied the patch from Weston Price with the following modifications.

        1. The test case now extends QpidBrokerTestCase instead of TestCase to ensure that it can run under the automated ant builds.

        2. Added an additional case to testIsSameRMMultiCF to ensure that isSameRM() returns false for two XAResources created from two different brokers.

        3. Excluded this test from the Java test profiles.

        Show
        Rajith Attapattu added a comment - Applied the patch from Weston Price with the following modifications. 1. The test case now extends QpidBrokerTestCase instead of TestCase to ensure that it can run under the automated ant builds. 2. Added an additional case to testIsSameRMMultiCF to ensure that isSameRM() returns false for two XAResources created from two different brokers. 3. Excluded this test from the Java test profiles.
        Hide
        Weston M. Price added a comment -

        why are you awake?

        Show
        Weston M. Price added a comment - why are you awake?
        Hide
        Gordon Sim added a comment -

        Looks fine to me. (I might have been tempted to call the new method getBrokerId() since it returns a string which could potentially be any form of identifier. Very minor and subjective issue though).

        Show
        Gordon Sim added a comment - Looks fine to me. (I might have been tempted to call the new method getBrokerId() since it returns a string which could potentially be any form of identifier. Very minor and subjective issue though).
        Weston M. Price made changes -
        Attachment qpid3263.patch [ 12482928 ]
        Hide
        Weston M. Price added a comment -

        Adding patch for isSameRM fix.

        Show
        Weston M. Price added a comment - Adding patch for isSameRM fix.
        Weston M. Price made changes -
        Field Original Value New Value
        Attachment MRG-00471937.zip [ 12479623 ]
        Hide
        Weston M. Price added a comment -

        Test case showing incorrect or incomplete isSameRM implementation in client XAResourceImpl.java

        Show
        Weston M. Price added a comment - Test case showing incorrect or incomplete isSameRM implementation in client XAResourceImpl.java
        Hide
        Weston M. Price added a comment -

        Note, this was reported internally at RedHat via a customer. I am also attaching a test case as provided by the customer that shows the issue. I am working on a patch to fix the issue that I will submit to the review board once complete.

        Show
        Weston M. Price added a comment - Note, this was reported internally at RedHat via a customer. I am also attaching a test case as provided by the customer that shows the issue. I am working on a patch to fix the issue that I will submit to the review board once complete.
        Weston M. Price created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Weston M. Price
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 24h
              24h
              Remaining:
              Remaining Estimate - 24h
              24h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development