org.mortbay.thread
Class Timeout
java.lang.Object
org.mortbay.thread.Timeout
public class Timeout
- extends Object
Timeout queue.
This class implements a timeout queue for timers that are at least as likely to be cancelled as they are to expire.
Unlike the util timeout class, the duration of the timouts is shared by all scheduled tasks and if the duration
is changed, this affects all scheduled tasks.
The nested class Task should be extended by users of this class to obtain call back notification of
expiries.
This class is not synchronized and the caller must protect against multiple thread access.
- Author:
- gregw
Timeout
public Timeout()
getDuration
public long getDuration()
- Returns:
- Returns the duration.
setDuration
public void setDuration(long duration)
- Parameters:
duration
- The duration to set.
setNow
public void setNow()
getNow
public long getNow()
setNow
public void setNow(long now)
expired
public Timeout.Task expired()
tick
public void tick()
schedule
public void schedule(Timeout.Task task)
schedule
public void schedule(Timeout.Task task,
long delay)
cancelAll
public void cancelAll()
isEmpty
public boolean isEmpty()
getTimeToNext
public long getTimeToNext()
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2009 Mort Bay Consulting. All Rights Reserved.