You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by "J.C." <j_...@mac.com> on 2001/10/17 04:09:20 UTC

[PATCH] IDBroker

If the system clock is set back at any point while your app is running, and an object is created before the "original" time, the "timeLapse" value would be negative, which would make the "clever quantity" negative.

Not good.


Index: IDBroker.java
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/util/db/IDBroker.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 IDBroker.java
--- IDBroker.java	2001/08/16 05:09:47	1.1.1.1
+++ IDBroker.java	2001/10/17 01:46:22
@@ -493,7 +493,7 @@
             long thenLong = lastTime.getTime();
             long nowLong = now.getTime();
             int timeLapse = (int)(nowLong-thenLong);
-            if ( timeLapse < sleepPeriod )
+            if ( timeLapse < sleepPeriod  && timeLapse > 0 )
             {
                 Log.info("Unscheduled retrieval of more ids for table: " +
                          tableName);

-- 
########################################################
##                  J.C.    j_c@mac.com
##                -- Idiot Extrodinare --
########################################################

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: [PATCH] IDBroker

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Thanks JC, applied to jakarta-turbine-2 and jakarta-turbine-torque CVS.

"J.C." <j_...@mac.com> writes:

> If the system clock is set back at any point while your app is running, and an object is created before the "original" time, the "timeLapse" value would be negative, which would make the "clever quantity" negative.
>
> Not good.
>
>
> Index: IDBroker.java
> ===================================================================
> RCS file: /home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/util/db/IDBroker.java,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 IDBroker.java
> --- IDBroker.java	2001/08/16 05:09:47	1.1.1.1
> +++ IDBroker.java	2001/10/17 01:46:22
> @@ -493,7 +493,7 @@
>              long thenLong = lastTime.getTime();
>              long nowLong = now.getTime();
>              int timeLapse = (int)(nowLong-thenLong);
> -            if ( timeLapse < sleepPeriod )
> +            if ( timeLapse < sleepPeriod  && timeLapse > 0 )
>              {
>                  Log.info("Unscheduled retrieval of more ids for table: " +
>                           tableName);

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org