kiwi.util
Class TimerPool

java.lang.Object
  extended bykiwi.util.ResourcePool
      extended bykiwi.util.TimerPool

public class TimerPool
extends ResourcePool

A concrete implementation of ResourcePool for managing a pool of IntervalTimers.

Author:
Mark Lindner, PING Software Group

Field Summary
 
Fields inherited from class kiwi.util.ResourcePool
 
Constructor Summary
TimerPool(int size)
          Construct a new TimerPool of the specified size.
 
Method Summary
protected  Resource constructResource()
          Construct a new IntervalTimer.
 void releaseTimer(IntervalTimer timer)
          Release a timer back into the pool.
 IntervalTimer reserveTimer()
          Reserve a timer from the pool.
 
Methods inherited from class kiwi.util.ResourcePool
getAvailableResourceCount, getTotalResourceCount, getUsedResourceCount, releaseResource, reserveResource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimerPool

public TimerPool(int size)
Construct a new TimerPool of the specified size.

Parameters:
size - The number of IntervalTimers to preallocate.
Method Detail

constructResource

protected Resource constructResource()
Construct a new IntervalTimer.

Specified by:
constructResource in class ResourcePool
Returns:
The new IntervalTimer.

reserveTimer

public IntervalTimer reserveTimer()
Reserve a timer from the pool. If all timers are currently in use, the method blocks until one becomes available.

Returns:
An IntervalTimer instance.

releaseTimer

public void releaseTimer(IntervalTimer timer)
Release a timer back into the pool.

Parameters:
timer - The timer to release.