1787ba0ceb1f379848e5337ee0076d6bd4b5dedb
[controller.git] / opendaylight / md-sal / mdsal-trace / dom-impl / src / main / java / org / opendaylight / controller / md / sal / trace / closetracker / impl / CloseTracked.java
1 /*
2  * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.md.sal.trace.closetracker.impl;
9
10 import org.eclipse.jdt.annotation.Nullable;
11
12 /**
13  * Object which can track where something has been created, and if it has been correctly "closed".
14  *
15  * <p>Includes preserving the context of the call stack which created an object, and the instant it was created.
16  *
17  * @author Michael Vorburger.ch
18  */
19 @Deprecated(forRemoval = true)
20 public interface CloseTracked<T extends CloseTracked<T>> {
21
22     /**
23      * This returns the allocation context as {@link StackTraceElement}s. NB that
24      * this is a relatively <b>EXPENSIVE</b> operation! You should only ever call
25      * this when you really need to, e.g. when you actually produce output for
26      * humans, but not too early.
27      */
28     // TODO When we're on Java 9, then instead return a StackWalker.StackFrame[] here?
29     @Nullable StackTraceElement[] getAllocationContextStackTrace();
30
31     CloseTracked<T> getRealCloseTracked();
32 }