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 final class WriteTrackingReadWriteTransaction extends ForwardingReadWriteTransaction
20 implements WriteTrackingTransaction {
21 // This is volatile to ensure we get the latest value; transactions aren't supposed to be used in multiple threads,
22 // but the cost here is tiny (one read penalty at the end of a transaction) so we play it safe
23 private volatile boolean written;
25 WriteTrackingReadWriteTransaction(final ReadWriteTransaction delegate) {
30 public <T extends DataObject> void put(final LogicalDatastoreType store, final InstanceIdentifier<T> path,
32 super.put(store, path, data);
37 public <T extends DataObject> void mergeParentStructurePut(final LogicalDatastoreType store,
38 final InstanceIdentifier<T> path, final T data) {
39 super.mergeParentStructurePut(store, path, data);
44 public <T extends DataObject> void merge(final LogicalDatastoreType store, final InstanceIdentifier<T> path,
46 super.merge(store, path, data);
51 public <T extends DataObject> void mergeParentStructureMerge(final LogicalDatastoreType store,
52 final InstanceIdentifier<T> path, final T data) {
53 super.mergeParentStructureMerge(store, path, data);
58 public void delete(final LogicalDatastoreType store, final InstanceIdentifier<?> path) {
59 super.delete(store, path);
64 public boolean isWritten() {