Class AutoCloseableWithLeakDetectionBase

  • All Implemented Interfaces:
    AutoCloseable

    public class AutoCloseableWithLeakDetectionBase
    extends AutoCloseableBase
    A base implementation of AutoClosable that helps detecting resource leaks. Creation of an instance of this class captures a snapshot of the stack trace. If finalize is called (typically only by the GC) and there was no prior call to close then a warning including the stack trace is logged. Implementing classes should override AutoCloseableBase.closeActual() rather than AutoCloseableBase.close().
    Author:
    Claus Stadler
    • Field Detail

      • instantiationStackTrace

        protected final StackTraceElement[] instantiationStackTrace
    • Constructor Detail

      • AutoCloseableWithLeakDetectionBase

        public AutoCloseableWithLeakDetectionBase()