Mail Archive Home | gotm-commits List | November 2005 Index
| <-- Date Index --> | <-- Thread Index --> |
Date: Monday, November 21, 2005 @ 12:07:59
Author: rouvoy
Path: /cvsroot/gotm/gotm/src/java/org/objectweb/gotm/lib
Modified: coordination/TimeoutImpl.java timer/TimerImpl.java
* Converting sec. -> ms. in Timeout component.
* Updating the Timer component.
-------------------------------+
coordination/TimeoutImpl.java | 6 +++---
timer/TimerImpl.java | 19 +++++++++++++------
2 files changed, 16 insertions(+), 9 deletions(-)
Index: gotm/src/java/org/objectweb/gotm/lib/coordination/TimeoutImpl.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/coordination/TimeoutImpl.java:1.9
gotm/src/java/org/objectweb/gotm/lib/coordination/TimeoutImpl.java:1.10
--- gotm/src/java/org/objectweb/gotm/lib/coordination/TimeoutImpl.java:1.9
Fri Nov 18 14:49:48 2005
+++ gotm/src/java/org/objectweb/gotm/lib/coordination/TimeoutImpl.java Mon
Nov 21 12:07:58 2005
@@ -23,7 +23,7 @@
Contributor(s): .
---------------------------------------------------------------------
- $Id: TimeoutImpl.java,v 1.9 2005/11/18 13:49:48 rouvoy Exp $
+ $Id: TimeoutImpl.java,v 1.10 2005/11/21 11:07:58 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.coordination;
@@ -43,7 +43,7 @@
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
* @fractal.itf name="timer" role="client"
signature="org.objectweb.gotm.lib.timer.Timer"
*/
public class TimeoutImpl
@@ -109,7 +109,7 @@
if (getLogger().isLoggable(DEBUG))
getLogger().log(DEBUG, "Starting timeout for
"+getTimeout()+" sec.");
if (this.first)
- getTimer().start(getTimeout());
+ getTimer().start(getTimeout()*1000);
else
getTimer().restart();
}
Index: gotm/src/java/org/objectweb/gotm/lib/timer/TimerImpl.java
diff -u gotm/src/java/org/objectweb/gotm/lib/timer/TimerImpl.java:1.2
gotm/src/java/org/objectweb/gotm/lib/timer/TimerImpl.java:1.3
--- gotm/src/java/org/objectweb/gotm/lib/timer/TimerImpl.java:1.2 Mon
Nov 21 11:09:52 2005
+++ gotm/src/java/org/objectweb/gotm/lib/timer/TimerImpl.java Mon Nov 21
12:07:58 2005
@@ -23,7 +23,7 @@
Contributor(s): .
---------------------------------------------------------------------
- $Id: TimerImpl.java,v 1.2 2005/11/21 10:09:52 rouvoy Exp $
+ $Id: TimerImpl.java,v 1.3 2005/11/21 11:07:58 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.timer;
@@ -37,8 +37,8 @@
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 18 nov. 2005
- * @modified $Date: 2005/11/21 10:09:52 $
- * @version $Revision: 1.2 $
+ * @modified $Date: 2005/11/21 11:07:58 $
+ * @version $Revision: 1.3 $
* @fractal.itf name="coord-process" role="client"
*
signature="org.objectweb.transaction.api.coordination.CoordinationFeature"
*/
@@ -46,9 +46,9 @@
extends BindablePrimitive
implements org.objectweb.gotm.lib.timer.Timer {
+ private long remaining = 0;
private Timer timer = new Timer();
- private TimerTask task = new TerminateTask();
- private long remaining ;
+ private TimerTask task ;
private class TerminateTask extends TimerTask {
public void run() {
@@ -87,6 +87,10 @@
* @see org.objectweb.gotm.lib.timer.Timer#restart()
*/
public void restart() {
+ if (getLogger().isLoggable(DEBUG))
+ getLogger().log(DEBUG, "Timer started (rem.="+this.remaining+"
ms)");
+ if (this.remaining < 0) return;
+ this.task = new TerminateTask();
this.timer.schedule(this.task, this.remaining);
}
@@ -94,7 +98,10 @@
* @see org.objectweb.gotm.lib.timer.Timer#stop()
*/
public void stop() {
- this.remaining=
this.task.scheduledExecutionTime()-System.currentTimeMillis();
+ this.remaining =
this.task.scheduledExecutionTime()-System.currentTimeMillis();
+ if (getLogger().isLoggable(DEBUG))
+ getLogger().log(DEBUG, "Timer stopped (rem.="+this.remaining+"
ms)");
+ this.task.cancel();
this.timer.purge();
}
}
\ No newline at end of file
| <-- Date Index --> | <-- Thread Index --> |
Powered by MHonArc.
Copyright © 2006-2007, OW2 Consortium | contact | webmaster.