org.apache.activemq.apollo.util
Class TimerHeap<V>

java.lang.Object
  extended by org.apache.activemq.apollo.util.TimerHeap<V>

public abstract class TimerHeap<V>
extends java.lang.Object


Constructor Summary
TimerHeap()
           
 
Method Summary
 void addAbsolute(V timed, long time, java.util.concurrent.TimeUnit timeUnit)
           
 void addRelative(V timed, long delay, java.util.concurrent.TimeUnit timeUnit)
           
protected abstract  void execute(V ready)
          Subclass must override this to execute ready timers
 void executeReadyTimers()
          Executes ready timers.
 int size()
           
 long timeToNext(java.util.concurrent.TimeUnit unit)
          Returns the time of the next scheduled event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimerHeap

public TimerHeap()
Method Detail

addAbsolute

public final void addAbsolute(V timed,
                              long time,
                              java.util.concurrent.TimeUnit timeUnit)

addRelative

public final void addRelative(V timed,
                              long delay,
                              java.util.concurrent.TimeUnit timeUnit)

size

public int size()

timeToNext

public final long timeToNext(java.util.concurrent.TimeUnit unit)
Returns the time of the next scheduled event.

Returns:
-1 if there are no events, otherwise the time that the next timer should fire.

executeReadyTimers

public final void executeReadyTimers()
Executes ready timers.


execute

protected abstract void execute(V ready)
Subclass must override this to execute ready timers

Parameters:
ready - The ready operation.


Copyright © 2005-2011 The Apache Software Foundation. All Rights Reserved.