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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user