public class FinalizerHandler
extends java.lang.Object
FinalizerHandler
class implements the functionality to
register Finalizer
s and call them at some point in time, such as
the end of the current ExecutionContext
.
The registered Finalizer
s will be called in the reverse sequence
of their registration. That is the last Finalizer
registered will
get called first.
Constructor and Description |
---|
FinalizerHandler() |
Modifier and Type | Method and Description |
---|---|
void |
callFinalizers()
Calls all registered
Finalizer Finalizer.doFinalize()
method, and removes them from the internal list. |
boolean |
isEmpty()
Returns
true if no Finalizer objects are registered
yet. |
void |
registerObject(Finalizer object)
Registers a
Finalizer . |
void |
unregister(Finalizer object)
Unregisters a
Finalizer object. |
void |
unregisterAll()
Unregisters all registered
Finalizer objects so that a
subsequent call to callFinalizers() effectively does nothing. |
public void registerObject(Finalizer object)
Finalizer
.object
- the finalzier to registerpublic void unregister(Finalizer object)
Finalizer
object. After unregistering the
objects doFinalize()
method is not called anymore.object
- The Finalizer
object to unregister.public void unregisterAll()
Finalizer
objects so that a
subsequent call to callFinalizers()
effectively does nothing.public boolean isEmpty()
true
if no Finalizer
objects are registered
yet.public void callFinalizers()
Finalizer
Finalizer.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 a Throwable
is thrown
this is logged as an error and processing continiues with the next
Finalizer
to be finalized.
Copyright © 2010 - 2020 Adobe. All Rights Reserved