net.sf.farrago.util
Class FarragoTimerAllocation
java.lang.Object
net.sf.farrago.util.FarragoTimerAllocation
- All Implemented Interfaces:
- FarragoAllocation, ClosableAllocation
public class FarragoTimerAllocation
- extends Object
- implements FarragoAllocation
FarragoTimerAllocation takes care of cancelling a Timer when it is closed.
Cancellation is implemented synchronously and without any delay, making it
easy to avoid shutdown races.
NOTE jvs 13-Aug-2007: The shutdown mechanism requires that cancellation
not happen via any other means. If it does, the shutdown could result in an
IllegalStateException
or a hang. Use FarragoTimerTask
to
avoid the implicit cancellation which can occur when a timer task throws an
exception.
- Version:
- $Id: //open/dev/farrago/src/net/sf/farrago/util/FarragoTimerAllocation.java#15 $
- Author:
- John V. Sichi
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
timer
private Timer timer
shutdownSynch
private final Object shutdownSynch
FarragoTimerAllocation
public FarragoTimerAllocation(FarragoAllocationOwner owner,
Timer timer)
- Creates a new FarragoTimerAllocation.
- Parameters:
owner
- the owner for the timertimer
- the timer to be cancelled when this allocation is closed
closeAllocation
public void closeAllocation()
- Description copied from interface:
ClosableAllocation
- Closes this object.
- Specified by:
closeAllocation
in interface ClosableAllocation