Author: doogie
Date: Sun Mar 14 02:21:14 2010
New Revision: 922733
URL:
http://svn.apache.org/viewvc?rev=922733&view=revLog:
Thread.sleep takes a long, not an int, so convert the wait time to long calculations. Also, remove the use of new Double().
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java?rev=922733&r1=922732&r2=922733&view=diff==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java Sun Mar 14 02:21:14 2010
@@ -112,8 +112,8 @@ public class SequenceUtil {
public static final long defaultBankSize = 10;
public static final long maxBankSize = 5000;
public static final long startSeqId = 10000;
- public static final int minWaitMillis = 5;
- public static final int maxWaitMillis = 50;
+ public static final long minWaitMillis = 5;
+ public static final long maxWaitMillis = 50;
public static final int maxTries = 5;
private long curSeqId;
@@ -315,7 +315,7 @@ public class SequenceUtil {
}
// collision happened, wait a bounded random amount of time then continue
- int waitTime = (new Double(Math.random() * (maxWaitMillis - minWaitMillis))).intValue() + minWaitMillis;
+ long waitTime = (long) (Math.random() * (maxWaitMillis - minWaitMillis) + minWaitMillis);
Debug.logWarning("[SequenceUtil.SequenceBank.fillBank] Collision found for seqName [" + seqName + "], val1=" + val1 + ", val2=" + val2 + ", val1+bankSize=" + (val1 + bankSize) + ", bankSize=" + bankSize + ", waitTime=" + waitTime, module);