Patch from Charlie Groves:

Convenience method to schedule a non-recurring Interval at a specific time.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2342 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray
2008-07-23 21:49:27 +00:00
parent e67458d55f
commit e04f56ce4f
@@ -20,6 +20,7 @@
package com.samskivert.util;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
@@ -77,6 +78,15 @@ public abstract class Interval
*/
public abstract void expired ();
/**
* Schedules this interval to execute once at <code>when</code>. Supersedes any previous
* schedule that this Interval may have had.
*/
public final void schedule (Date when)
{
schedule(when.getTime() - System.currentTimeMillis());
}
/**
* Schedule the interval to execute once, after the specified delay. Supersedes any previous
* schedule that this Interval may have had.