[jboss-cvs] JBossAS SVN: r65455 - trunk/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:26:49 EDT 2007


Author: dimitris at jboss.org
Date: 2007-09-18 13:26:49 -0400 (Tue, 18 Sep 2007)
New Revision: 65455

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

Modified: trunk/server/src/main/org/jboss/ejb/txtimer/BigIntegerTimerIdGenerator.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/txtimer/BigIntegerTimerIdGenerator.java	2007-09-18 17:25:43 UTC (rev 65454)
+++ trunk/server/src/main/org/jboss/ejb/txtimer/BigIntegerTimerIdGenerator.java	2007-09-18 17:26:49 UTC (rev 65455)
@@ -1,8 +1,8 @@
 /*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
@@ -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