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.mdsal.binding.util;
10 import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
11 import org.opendaylight.mdsal.binding.spi.ForwardingReadWriteTransaction;
12 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
13 import org.opendaylight.yangtools.yang.binding.DataObject;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
17 * Read-write transaction which keeps track of writes.
19 class WriteTrackingReadWriteTransaction extends ForwardingReadWriteTransaction 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 WriteTrackingReadWriteTransaction(ReadWriteTransaction delegate) {
29 public <T extends DataObject> void put(LogicalDatastoreType store, InstanceIdentifier<T> path, T data) {
30 super.put(store, path, data);
35 public <T extends DataObject> void put(LogicalDatastoreType store, InstanceIdentifier<T> path, T data,
36 boolean createMissingParents) {
37 super.put(store, path, data, createMissingParents);
42 public <T extends DataObject> void merge(LogicalDatastoreType store, InstanceIdentifier<T> path, T data) {
43 super.merge(store, path, data);
48 public <T extends DataObject> void merge(LogicalDatastoreType store, InstanceIdentifier<T> path, T data,
49 boolean createMissingParents) {
50 super.merge(store, path, data, createMissingParents);
55 public void delete(LogicalDatastoreType store, InstanceIdentifier<?> path) {
56 super.delete(store, path);
61 public boolean isWritten() {