Deprecate all MD-SAL APIs
[controller.git] / opendaylight / md-sal / mdsal-trace / dom-impl / src / main / java / org / opendaylight / controller / md / sal / trace / dom / impl / TracingWriteTransaction.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.dom.impl;
9
10 import com.google.common.util.concurrent.FluentFuture;
11 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
12 import org.opendaylight.controller.md.sal.trace.closetracker.impl.CloseTracked;
13 import org.opendaylight.controller.md.sal.trace.closetracker.impl.CloseTrackedRegistry;
14 import org.opendaylight.controller.md.sal.trace.closetracker.impl.CloseTrackedTrait;
15 import org.opendaylight.mdsal.common.api.CommitInfo;
16
17 @Deprecated
18 class TracingWriteTransaction extends AbstractTracingWriteTransaction
19         implements CloseTracked<TracingWriteTransaction> {
20
21     private final CloseTrackedTrait<TracingWriteTransaction> closeTracker;
22
23     TracingWriteTransaction(DOMDataWriteTransaction delegate, TracingBroker tracingBroker,
24             CloseTrackedRegistry<TracingWriteTransaction> writeTransactionsRegistry) {
25         super(delegate, tracingBroker);
26         this.closeTracker = new CloseTrackedTrait<>(writeTransactionsRegistry, this);
27     }
28
29     @Override
30     public FluentFuture<? extends CommitInfo> commit() {
31         closeTracker.removeFromTrackedRegistry();
32         return super.commit();
33     }
34
35     @Override
36     public boolean cancel() {
37         closeTracker.removeFromTrackedRegistry();
38         return super.cancel();
39     }
40
41     @Override
42     public StackTraceElement[] getAllocationContextStackTrace() {
43         return closeTracker.getAllocationContextStackTrace();
44     }
45
46     @Override
47     public CloseTracked<TracingWriteTransaction> getRealCloseTracked() {
48         return this;
49     }
50
51 }

©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.