Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 98970 invoked from network); 4 Feb 2009 19:48:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Feb 2009 19:48:34 -0000 Received: (qmail 99918 invoked by uid 500); 4 Feb 2009 19:48:34 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 99871 invoked by uid 500); 4 Feb 2009 19:48:34 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 99862 invoked by uid 99); 4 Feb 2009 19:48:34 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Feb 2009 11:48:34 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Feb 2009 19:48:32 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 568A2238896B; Wed, 4 Feb 2009 19:48:11 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r740839 - /geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/XidFactoryImpl.java Date: Wed, 04 Feb 2009 19:48:11 -0000 To: scm@geronimo.apache.org From: gawor@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090204194811.568A2238896B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gawor Date: Wed Feb 4 19:48:10 2009 New Revision: 740839 URL: http://svn.apache.org/viewvc?rev=740839&view=rev Log: add some random bytes to baseId. Patch from Gary Tully (GERONIMO-4393) Modified: geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/XidFactoryImpl.java Modified: geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/XidFactoryImpl.java URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/XidFactoryImpl.java?rev=740839&r1=740838&r2=740839&view=diff ============================================================================== --- geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/XidFactoryImpl.java (original) +++ geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/XidFactoryImpl.java Wed Feb 4 19:48:10 2009 @@ -17,6 +17,7 @@ package org.apache.geronimo.transaction.manager; +import java.util.Random; import javax.transaction.xa.Xid; import java.net.InetAddress; import java.net.UnknownHostException; @@ -26,6 +27,7 @@ * The Xid is constructed of three parts: *
  1. 8 byte count (LSB first)
  2. *
  3. 4 byte system id
  4. + *
  5. 2 byte entropy
  6. *
  7. 4 or 16 byte IP address of host
  8. *
      * @version $Rev$ $Date$ @@ -51,7 +53,13 @@ baseId[9] = (byte) (uid >>> 8); baseId[10] = (byte) (uid >>> 16); baseId[11] = (byte) (uid >>> 24); - System.arraycopy(hostid, 0, baseId, 12, hostid.length); + + byte[] entropy = new byte[2]; + new Random().nextBytes(entropy); + baseId[12] = entropy[0]; + baseId[13] = entropy[1]; + + System.arraycopy(hostid, 0, baseId, 14, hostid.length); } public Xid createXid() {