You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by da...@apache.org on 2006/12/08 21:26:12 UTC
svn commit: r484744 -
/webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/Timer.java
Author: danj
Date: Fri Dec 8 12:26:11 2006
New Revision: 484744
URL: http://svn.apache.org/viewvc?view=rev&rev=484744
Log:
Fix for MUSE-154
Modified:
webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/Timer.java
Modified: webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/Timer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/Timer.java?view=diff&rev=484744&r1=484743&r2=484744
==============================================================================
--- webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/Timer.java (original)
+++ webservices/muse/trunk/modules/muse-util/src/org/apache/muse/util/Timer.java Fri Dec 8 12:26:11 2006
@@ -57,34 +57,13 @@
/**
*
- * Create a new timer that will execute the given task. This does
- * <b>not</b> schedule the timer.
- *
- * @param task
- * The task to be executed if and when the timer is fired.
- *
- * @see #schedule(Date)
- *
- */
- public Timer(TimerTask task)
- {
- if (task == null)
- throw new NullPointerException(_MESSAGES.get("NullTimerTask"));
-
- _task = task;
- }
-
- /**
- *
* Cancels the timer. If the timer was not scheduled, this is a no-op.
* If it <b>was</b> scheduled, its task will not be executed and
* subsequent calls to getScheduledTime() will return null.
* <br><br>
* To reschedule a timer after it has been cancelled, you must use the
- * reschedule(Date) method - you cannot just call schedule(Date).
+ * reschedule(TimerTask, Date) method - you cannot just call schedule(TimerTask, Date).
*
- * @see #reschedule(Date)
- *
*/
public final void cancel()
{
@@ -142,12 +121,18 @@
* Cancels the timer (if it is currently scheduled) and reschedules it
* for the given time.
*
+ * @param task
+ * The code to run when the timer is up.
+ *
* @param whenToFire
* The new fire time for the timer.
*
*/
- public final void reschedule(Date whenToFire)
+ public final void reschedule(TimerTask task, Date whenToFire)
{
+ if (task == null)
+ throw new NullPointerException(_MESSAGES.get("NullTimerTask"));
+
if (whenToFire == null)
throw new NullPointerException(_MESSAGES.get("NullFireTime"));
@@ -157,7 +142,8 @@
//
cancel();
_timer = new java.util.Timer();
- schedule(whenToFire);
+
+ schedule(task, whenToFire);
}
/**
@@ -166,17 +152,25 @@
* timer's TimerTask being executed. If the given time is in the past,
* the timer will execute immediately (or as soon as its thread is given
* control).
+ *
+ * @param task
+ * The code to run when the timer is up.
*
* @param whenToFire
* The time when the timer should fire.
*
*/
- public final void schedule(Date whenToFire)
+ public final void schedule(TimerTask task, Date whenToFire)
{
+ if (task == null)
+ throw new NullPointerException(_MESSAGES.get("NullTimerTask"));
+
if (whenToFire == null)
throw new NullPointerException(_MESSAGES.get("NullFireTime"));
+ _task = task;
_whenToFire = whenToFire;
- _timer.schedule(_task, whenToFire);
+
+ _timer.schedule(_task, _whenToFire);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org