public interface SafelyCloseable extends Closeable
Classes implementing this interface must provide a safety-net finaliser—a finaliser that closes the resource and logs that resource should have been closed.
When the implementing class is abstract, concrete subclasses must
call super.close()
in their own Closeable.close()
method
to let the abstract class track correctly the resource. Moreover,
they must run super.finalize()
in
their own finaliser (if any), as finalisation chaining is not automatic.
Note that if a concrete subclass implements readResolve()
, it must
call super.close()
, or actually return this
(i.e., the deserialised
instance); otherwise, a spurious log could be generated when the deserialised instance is collected.
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.