Package com.day.util
Class FinalizerHandler
- java.lang.Object
 - 
- com.day.util.FinalizerHandler
 
 
- 
public class FinalizerHandler extends java.lang.ObjectTheFinalizerHandlerclass implements the functionality to registerFinalizers and call them at some point in time, such as the end of the currentExecutionContext.The registered
Finalizers will be called in the reverse sequence of their registration. That is the lastFinalizerregistered will get called first.- Since:
 - antbear Audience dev
 
 
- 
- 
Constructor Summary
Constructors Constructor Description FinalizerHandler() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcallFinalizers()Calls all registeredFinalizerFinalizer.doFinalize()method, and removes them from the internal list.booleanisEmpty()Returnstrueif noFinalizerobjects are registered yet.voidregisterObject(Finalizer object)Registers aFinalizer.voidunregister(Finalizer object)Unregisters aFinalizerobject.voidunregisterAll()Unregisters all registeredFinalizerobjects so that a subsequent call tocallFinalizers()effectively does nothing. 
 - 
 
- 
- 
Method Detail
- 
registerObject
public void registerObject(Finalizer object)
Registers aFinalizer.- Parameters:
 object- the finalzier to register
 
- 
unregister
public void unregister(Finalizer object)
Unregisters aFinalizerobject. After unregistering the objectsdoFinalize()method is not called anymore.- Parameters:
 object- TheFinalizerobject to unregister.
 
- 
unregisterAll
public void unregisterAll()
Unregisters all registeredFinalizerobjects so that a subsequent call tocallFinalizers()effectively does nothing. 
- 
isEmpty
public boolean isEmpty()
Returnstrueif noFinalizerobjects are registered yet.- Returns:
 - whether it's empty
 
 
- 
callFinalizers
public void callFinalizers()
Calls all registeredFinalizerFinalizer.doFinalize()method, and removes them from the internal list.The call to the
Finalizer.doFinalize()is not expected to throw any exceptions or even errors. In case aThrowableis thrown this is logged as an error and processing continiues with the nextFinalizerto be finalized. 
 - 
 
 -