2 * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.md.sal.trace.closetracker.impl;
10 import java.time.Instant;
11 import javax.annotation.Nullable;
14 * Convenience abstract base class for {@link CloseTracked} implementors.
16 * @author Michael Vorburger.ch
18 public abstract class AbstractCloseTracked<T extends AbstractCloseTracked<T>> implements CloseTracked<T> {
20 private final CloseTrackedTrait<T> closeTracker;
22 protected AbstractCloseTracked(CloseTrackedRegistry<T> transactionChainRegistry) {
23 this.closeTracker = new CloseTrackedTrait<>(transactionChainRegistry);
26 protected void removeFromTrackedRegistry() {
27 closeTracker.removeFromTrackedRegistry();
31 public final Instant getObjectCreated() {
32 return closeTracker.getObjectCreated();
36 public @Nullable StackTraceElement[] getAllocationContextStackTrace() {
37 return closeTracker.getAllocationContextStackTrace();