Finalizers are inherently problematic and their use can lead to performance issues,
deadlocks, hangs, and other problematic behavior.
Furthermore the timing of finalization is unpredictable with no guarantee that a finalizer will be called.
Classes whose instances hold non-heap resources should provide a method
to enable explicit release of those resources, and they should also implement
java.lang.AutoCloseable if appropriate.
The java.lang.ref.Cleaner and java.lang.ref.PhantomReference provide more flexible and
efficient ways to release resources when an object becomes unreachable.