geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r636842 - in /geronimo/sandbox/concurrent/geronimo-concurrent-core/src: main/java/org/apache/geronimo/concurrent/executor/AbstractManagedScheduledExecutorService.java test/java/org/apache/geronimo/concurrent/executor/TestTrigger.java
Date Thu, 13 Mar 2008 19:18:27 GMT
Author: gawor
Date: Thu Mar 13 12:18:26 2008
New Revision: 636842

URL: http://svn.apache.org/viewvc?rev=636842&view=rev
Log:
baseTime actaully meant submitTime

Modified:
    geronimo/sandbox/concurrent/geronimo-concurrent-core/src/main/java/org/apache/geronimo/concurrent/executor/AbstractManagedScheduledExecutorService.java
    geronimo/sandbox/concurrent/geronimo-concurrent-core/src/test/java/org/apache/geronimo/concurrent/executor/TestTrigger.java

Modified: geronimo/sandbox/concurrent/geronimo-concurrent-core/src/main/java/org/apache/geronimo/concurrent/executor/AbstractManagedScheduledExecutorService.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent-core/src/main/java/org/apache/geronimo/concurrent/executor/AbstractManagedScheduledExecutorService.java?rev=636842&r1=636841&r2=636842&view=diff
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent-core/src/main/java/org/apache/geronimo/concurrent/executor/AbstractManagedScheduledExecutorService.java
(original)
+++ geronimo/sandbox/concurrent/geronimo-concurrent-core/src/main/java/org/apache/geronimo/concurrent/executor/AbstractManagedScheduledExecutorService.java
Thu Mar 13 12:18:26 2008
@@ -76,7 +76,8 @@
         private Date lastActualRunTime;
         private Date lastScheduledRunTime;
         private Date lastCompleteTime;
-
+        private Date submitTime;
+        
         ScheduledFutureTask(Runnable r, 
                             V result, 
                             ManagedContext managedContext,
@@ -85,6 +86,7 @@
             super(r, result, managedContext, listener);
             this.lastScheduledRunTime = triggerTime;
             this.trigger = null;
+            this.submitTime = new Date();
             this.sequenceNumber = sequencer.getAndIncrement();
         }
         
@@ -95,8 +97,9 @@
                             Trigger trigger) {
             super(r, result, managedContext, listener);
             this.trigger = trigger;
+            this.submitTime = new Date();
             this.lastScheduledRunTime = 
-                trigger.getNextRunTime(this, new Date(), null, null, null);           
+                trigger.getNextRunTime(this, this.submitTime, null, null, null);        
  
             this.sequenceNumber = sequencer.getAndIncrement();
         }
 
@@ -107,6 +110,7 @@
             super(callable, managedContext, listener);
             this.lastScheduledRunTime = triggerTime;
             this.trigger = null;
+            this.submitTime = new Date();
             this.sequenceNumber = sequencer.getAndIncrement();
         }
         
@@ -116,8 +120,9 @@
                             Trigger trigger) {
             super(callable, managedContext, listener);
             this.trigger = trigger;
+            this.submitTime = new Date();
             this.lastScheduledRunTime = 
-                trigger.getNextRunTime(this, new Date(), null, null, null);
+                trigger.getNextRunTime(this, this.submitTime, null, null, null);
             this.sequenceNumber = sequencer.getAndIncrement();
         }
         
@@ -180,7 +185,7 @@
                         !isTerminating()))) {
                 this.lastScheduledRunTime = 
                     this.trigger.getNextRunTime(this, 
-                                                new Date(), 
+                                                this.submitTime,
                                                 this.lastActualRunTime, 
                                                 this.lastScheduledRunTime, 
                                                 this.lastCompleteTime); 
@@ -419,18 +424,18 @@
         }
         
         public Date getNextRunTime(Future<?> future,
-                                   Date baseTime,
+                                   Date submitTime,
                                    Date lastActualRunTime,
                                    Date lastScheduledRunTime,
                                    Date lastCompleteTime) {
             long nextRunTime;
             if (lastScheduledRunTime == null) {
-                nextRunTime = baseTime.getTime() + this.initialDelay;
+                nextRunTime = System.currentTimeMillis() + this.initialDelay;
             } else {
                 if (this.rate) {
                     nextRunTime = lastScheduledRunTime.getTime() + this.period;
                 } else {
-                    nextRunTime = baseTime.getTime() + this.period;
+                    nextRunTime = System.currentTimeMillis() + this.period;
                 }
             }
             return new Date(nextRunTime);

Modified: geronimo/sandbox/concurrent/geronimo-concurrent-core/src/test/java/org/apache/geronimo/concurrent/executor/TestTrigger.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/concurrent/geronimo-concurrent-core/src/test/java/org/apache/geronimo/concurrent/executor/TestTrigger.java?rev=636842&r1=636841&r2=636842&view=diff
==============================================================================
--- geronimo/sandbox/concurrent/geronimo-concurrent-core/src/test/java/org/apache/geronimo/concurrent/executor/TestTrigger.java
(original)
+++ geronimo/sandbox/concurrent/geronimo-concurrent-core/src/test/java/org/apache/geronimo/concurrent/executor/TestTrigger.java
Thu Mar 13 12:18:26 2008
@@ -126,7 +126,7 @@
         if (run == done) {
             return null;
         } else {                  
-            return new Date(arg1.getTime() + 1000 * 5);
+            return new Date(System.currentTimeMillis() + 1000 * 5);
         }
     }
 



Mime
View raw message