org.apache.camel.processor.resequencer
Class Timeout

java.lang.Object
  extended by java.util.TimerTask
      extended by org.apache.camel.processor.resequencer.Timeout
All Implemented Interfaces:
Runnable

public class Timeout
extends TimerTask

A timer task that notifies handlers about scheduled timeouts.

Version:
$Revision
Author:
Martin Krasser
See Also:
Timer, TimerTask

Constructor Summary
Timeout(Timer timer, long timeout)
          Creates a new timeout task using the given Timer instance a timeout value.
 
Method Summary
 void addTimeoutHandler(TimeoutHandler handler)
          Appends a new timeout handler at the end of the timeout handler list.
 void addTimeoutHandlerFirst(TimeoutHandler handler)
          inserts a new timeout handler at the beginning of the timeout handler list.
 void clearTimeoutHandlers()
          Removes all timeout handlers from the timeout handler list.
 List<TimeoutHandler> getTimeoutHandlers()
          Returns the list of timeout handlers that have been registered for notification.
 void run()
          Notifies all timeout handlers about the scheduled timeout.
 void schedule()
          Schedules this timeout task.
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Timeout

public Timeout(Timer timer,
               long timeout)
Creates a new timeout task using the given Timer instance a timeout value. The task is not scheduled immediately. It will be scheduled by calling this task's schedule() method.

Parameters:
timer -
timeout -
Method Detail

getTimeoutHandlers

public List<TimeoutHandler> getTimeoutHandlers()
Returns the list of timeout handlers that have been registered for notification.

Returns:
the list of timeout handlers

addTimeoutHandler

public void addTimeoutHandler(TimeoutHandler handler)
Appends a new timeout handler at the end of the timeout handler list.

Parameters:
handler - a timeout handler.

addTimeoutHandlerFirst

public void addTimeoutHandlerFirst(TimeoutHandler handler)
inserts a new timeout handler at the beginning of the timeout handler list.

Parameters:
handler - a timeout handler.

clearTimeoutHandlers

public void clearTimeoutHandlers()
Removes all timeout handlers from the timeout handler list.


schedule

public void schedule()
Schedules this timeout task.


run

public void run()
Notifies all timeout handlers about the scheduled timeout.

Specified by:
run in interface Runnable
Specified by:
run in class TimerTask


Copyright © 2008 IONA Open Source Community. All Rights Reserved.