*/
package org.opendaylight.controller.md.sal.trace.closetracker.impl;
-import java.time.Instant;
import javax.annotation.Nullable;
/**
- * Object which can track where it has been created, and if it has been correctly "closed".
+ * Object which can track where something has been created, and if it has been correctly "closed".
*
- * <p>Includes preserving the context of the call stack which created this object, and the instant it was created.
+ * <p>Includes preserving the context of the call stack which created an object, and the instant it was created.
*
* @author Michael Vorburger.ch
*/
public interface CloseTracked<T extends CloseTracked<T>> {
- Instant getObjectCreated();
-
+ /**
+ * This returns the allocation context as {@link StackTraceElement}s. NB that
+ * this is a relatively <b>EXPENSIVE</b> operation! You should only ever call
+ * this when you really need to, e.g. when you actually produce output for
+ * humans, but not too early.
+ */
+ // TODO When we're on Java 9, then instead return a StackWalker.StackFrame[] here?
@Nullable StackTraceElement[] getAllocationContextStackTrace();
+ CloseTracked<T> getRealCloseTracked();
}