Package org.aksw.commons.util.closeable
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 should overrideAutoCloseableBase.closeActual()rather thanAutoCloseableBase.close().- Author:
- Claus Stadler
-
-
Field Summary
Fields Modifier and Type Field Description protected StackTraceElement[]instantiationStackTrace-
Fields inherited from class org.aksw.commons.util.closeable.AutoCloseableBase
isClosed
-
-
Constructor Summary
Constructors Constructor Description AutoCloseableWithLeakDetectionBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidfinalize()StackTraceElement[]getInstantiationStackTrace()-
Methods inherited from class org.aksw.commons.util.closeable.AutoCloseableBase
close, closeActual, ensureOpen
-
-
-
-
Field Detail
-
instantiationStackTrace
protected final StackTraceElement[] instantiationStackTrace
-
-
Method Detail
-
getInstantiationStackTrace
public StackTraceElement[] getInstantiationStackTrace()
-
-