org.mortbay.thread
Class Timeout.Task

java.lang.Object
  extended by org.mortbay.thread.Timeout.Task
Direct Known Subclasses:
SelectChannelConnector.HttpEndPoint.IdleTask, SelectChannelConnector.RetryContinuation
Enclosing class:
Timeout

public static class Timeout.Task
extends Object

Task. The base class for scheduled timeouts. This class should be extended to implement the expire() method, which is called if the timeout expires.

Author:
gregw

Field Summary
(package private)  long _delay
           
(package private)  boolean _expired
           
(package private)  Timeout.Task _next
           
(package private)  Timeout.Task _prev
           
(package private)  Timeout _timeout
           
(package private)  long _timestamp
           
 
Constructor Summary
Timeout.Task()
           
 
Method Summary
 void cancel()
          Cancel the task.
private  void doExpire()
           
 void expire()
          Expire task.
 boolean isExpired()
           
 void reschedule()
          Reschedule the task on the current timeout.
 void schedule(Timeout timer)
          Schedule the task on the given timeout.
 void schedule(Timeout timer, long delay)
          Schedule the task on the given timeout.
 void setNext(Timeout.Task task)
           
 void unlink()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_next

Timeout.Task _next

_prev

Timeout.Task _prev

_timeout

Timeout _timeout

_delay

long _delay

_timestamp

long _timestamp

_expired

boolean _expired
Constructor Detail

Timeout.Task

public Timeout.Task()
Method Detail

unlink

public void unlink()

setNext

public void setNext(Timeout.Task task)

schedule

public void schedule(Timeout timer)
Schedule the task on the given timeout. The task exiry will be called after the timeout duration.

Parameters:
timer -

schedule

public void schedule(Timeout timer,
                     long delay)
Schedule the task on the given timeout. The task exiry will be called after the timeout duration.

Parameters:
timer -

reschedule

public void reschedule()
Reschedule the task on the current timeout. The task timeout is rescheduled as if it had been canceled and scheduled on the current timeout.


cancel

public void cancel()
Cancel the task. Remove the task from the timeout.


isExpired

public boolean isExpired()

expire

public void expire()
Expire task. This method is called when the timeout expires.


doExpire

private void doExpire()