Bug 9060: Minor [Java|inline] doc update re. getStackTrace() performance
[mdsal.git] / dom-impl / src / main / java / org / opendaylight / controller / md / sal / trace / closetracker / impl / CloseTracked.java
index 1febe153eace20b415bde54d8b90278545de2bd1..ef42c4025c6232494ff1f9a92048edfb7189ae5e 100644 (file)
@@ -7,20 +7,25 @@
  */
 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();
 }