[jboss-cvs] JBossAS SVN: r65454 - branches/Branch_4_2/server/src/main/org/jboss/ejb/txtimer.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Sep 18 13:25:44 EDT 2007


Author: dimitris at jboss.org
Date: 2007-09-18 13:25:43 -0400 (Tue, 18 Sep 2007)
New Revision: 65454

Modified:
   branches/Branch_4_2/server/src/main/org/jboss/ejb/txtimer/BigIntegerTimerIdGenerator.java
Log:
JBAS-3379, seed using currentTimeMillis to avoid duplicate ids upon restart

Modified: branches/Branch_4_2/server/src/main/org/jboss/ejb/txtimer/BigIntegerTimerIdGenerator.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/ejb/txtimer/BigIntegerTimerIdGenerator.java	2007-09-18 17:08:23 UTC (rev 65453)
+++ branches/Branch_4_2/server/src/main/org/jboss/ejb/txtimer/BigIntegerTimerIdGenerator.java	2007-09-18 17:25:43 UTC (rev 65454)
@@ -29,20 +29,22 @@
  * A timerId generator that uses a BigInteger count.
  *
  * @author Thomas.Diesler at jboss.org
+ * @author Dimitris.Andreadis at jboss.org
  * @version $Revision$
  * @since 10-Sep-2004
  */
 public class BigIntegerTimerIdGenerator implements TimerIdGenerator
 {
    // The next timer identity
-   private BigInteger nextTimerId = BigInteger.valueOf(0);
+   // JBAS-3379, seed using currentTimeMillis to avoid duplicate ids upon restart
+   private BigInteger nextTimerId = BigInteger.valueOf(System.currentTimeMillis());
 
    /**
     * Get the next timer id
     */
    public synchronized String nextTimerId()
    {
-      nextTimerId = nextTimerId.add(BigInteger.valueOf(1));
+      nextTimerId = nextTimerId.add(BigInteger.ONE);
       return nextTimerId.toString();
    }
 }




More information about the jboss-cvs-commits mailing list