com.rabbitmq.utility
Class SingleShotLinearTimer

java.lang.Object
  extended by com.rabbitmq.utility.SingleShotLinearTimer

public class SingleShotLinearTimer
extends java.lang.Object

This class provides a very stripped-down clone of some of the functionality in java.util.Timer (notably Timer.schedule(TimerTask task, long delay) but uses System.nanoTime() rather than System.currentTimeMillis() as a measure of the underlying time, and thus behaves correctly if the system clock jumps around. This class does not have any relation to TimerTask due to the coupling between TimerTask and Timer - for example if someone invokes TimerTask.cancel(), we can't find out about it as TimerTask.state is package-private. We currently just use this to time the quiescing RPC in AMQChannel.

See Also:
AMQChannel

Constructor Summary
SingleShotLinearTimer()
           
 
Method Summary
 void cancel()
           
 void schedule(java.lang.Runnable task, int timeoutMillisec)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleShotLinearTimer

public SingleShotLinearTimer()
Method Detail

schedule

public void schedule(java.lang.Runnable task,
                     int timeoutMillisec)

cancel

public void cancel()