Package edu.emory.mathcs.util.gc

This package provides utilities for "better finalization" -- that is, reclamation of resources associated with objects that have been garbage collected, and also reclamation of such resources at VM exit.

See:
          Description

Interface Summary
FinalizationFuture  
FinalizationInvoker  
Finalizer  
ReferenceCleaner.CleanableReference  
 

Class Summary
FinalizationEngine  
FinalizationGroup Allows grouping together finalizers of similar object types, so that they could e.g.
FinalizationStatus  
ReferenceCleaner  
 

Package edu.emory.mathcs.util.gc Description

This package provides utilities for "better finalization" -- that is, reclamation of resources associated with objects that have been garbage collected, and also reclamation of such resources at VM exit. The oldest way of implementing such reclamation is via finalize() method and System.runFinalizersOnExit(). Those are however problematic for many reasons -- there's no control over the thread in which finalizers execute, object resurrection is possible, and finalization upon VM exit is inherently deadlock prone and deprecated. The Emory APIs build upon java.lang.ref to provide a reliable finalization framework addressing these shortcomings, and give users much more control over what and when is going on. The framework is used in the H2O project to ensure that a client closes its remote sessions on remote machines when session objects are garbage collected or when its JVM exits.