59dbf5749de456c1e2c723a9c96f7089f3fe1512
[controller.git] / opendaylight / md-sal / mdsal-trace / dom-impl / src / main / java / org / opendaylight / controller / md / sal / trace / closetracker / impl / AbstractCloseTracked.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 java.time.Instant;
11 import javax.annotation.Nullable;
12
13 /**
14  * Convenience abstract base class for {@link CloseTracked} implementors.
15  *
16  * @author Michael Vorburger.ch
17  */
18 public abstract class AbstractCloseTracked<T extends AbstractCloseTracked<T>> implements CloseTracked<T> {
19
20     private final CloseTrackedTrait<T> closeTracker;
21
22     protected AbstractCloseTracked(CloseTrackedRegistry<T> transactionChainRegistry) {
23         this.closeTracker = new CloseTrackedTrait<>(transactionChainRegistry);
24     }
25
26     protected void removeFromTrackedRegistry() {
27         closeTracker.removeFromTrackedRegistry();
28     }
29
30     @Override
31     public final Instant getObjectCreated() {
32         return closeTracker.getObjectCreated();
33     }
34
35     @Override
36     public @Nullable StackTraceElement[] getAllocationContextStackTrace() {
37         return closeTracker.getAllocationContextStackTrace();
38     }
39 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.