2 * Copyright © 2018 Red Hat, Inc. and others.
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.genius.infra;
10 import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
11 import org.opendaylight.yangtools.yang.binding.DataObject;
12 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
15 * Read-write typed transaction which keeps track of writes.
17 class WriteTrackingTypedReadWriteTransactionImpl<D extends Datastore> extends TypedReadWriteTransactionImpl<D>
18 implements WriteTrackingTransaction {
20 // This is volatile to ensure we get the latest value; transactions aren't supposed to be used in multiple threads,
21 // but the cost here is tiny (one read penalty at the end of a transaction) so we play it safe
22 private volatile boolean written;
24 WriteTrackingTypedReadWriteTransactionImpl(Class<D> datastoreType, ReadWriteTransaction realTx) {
25 super(datastoreType, realTx);
29 public <T extends DataObject> void put(InstanceIdentifier<T> path, T data) {
30 super.put(path, data);
35 public <T extends DataObject> void put(InstanceIdentifier<T> path, T data, boolean createMissingParents) {
36 super.put(path, data, createMissingParents);
41 public <T extends DataObject> void merge(InstanceIdentifier<T> path, T data) {
42 super.merge(path, data);
47 public <T extends DataObject> void merge(InstanceIdentifier<T> path, T data, boolean createMissingParents) {
48 super.merge(path, data, createMissingParents);
53 public void delete(InstanceIdentifier<?> path) {
59 public boolean isWritten() {