Class AutoCloseableWithLeakDetectionBase

java.lang.Object
org.aksw.commons.util.closeable.AutoCloseableBase
org.aksw.commons.util.closeable.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 need to override AutoCloseableBase.closeActual() because AutoCloseableBase.close() is final.
Author:
Claus Stadler
  • Field Details

    • instantiationStackTrace

      protected final StackTraceElement[] instantiationStackTrace
  • Constructor Details

    • AutoCloseableWithLeakDetectionBase

      public AutoCloseableWithLeakDetectionBase()
    • AutoCloseableWithLeakDetectionBase

      public AutoCloseableWithLeakDetectionBase(boolean enableInstantiationStackTrace)
  • Method Details