Merge "BUG-1679: optinally log allocation context"
authorTony Tkacik <ttkacik@cisco.com>
Fri, 5 Sep 2014 07:09:35 +0000 (07:09 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 5 Sep 2014 07:09:35 +0000 (07:09 +0000)
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/config/yang/inmemory_datastore_provider/InMemoryConfigDataStoreProviderModule.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/config/yang/inmemory_datastore_provider/InMemoryOperationalDataStoreProviderModule.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/AbstractDOMStoreTransaction.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStore.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStoreFactory.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/SnapshotBackedReadTransaction.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/SnapshotBackedReadWriteTransaction.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/SnapshotBackedWriteTransaction.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/yang/opendaylight-inmemory-datastore-provider.yang
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDataStoreTest.java

index b98844ba641f6e7f585c3c6b687c56d55161933c..1ab12ff26f1bddc451f4aa3ceeddd111b8546f19 100644 (file)
@@ -22,9 +22,8 @@ public class InMemoryConfigDataStoreProviderModule extends org.opendaylight.cont
 
     @Override
     public java.lang.AutoCloseable createInstance() {
-
-        InMemoryDOMDataStore dataStore = InMemoryDOMDataStoreFactory.create(
-                "DOM-CFG", getSchemaServiceDependency(),
+        InMemoryDOMDataStore dataStore = InMemoryDOMDataStoreFactory.create("DOM-CFG", getSchemaServiceDependency(),
+                getDebugTransactions(),
                 InMemoryDOMDataStoreConfigProperties.create(getMaxDataChangeExecutorPoolSize(),
                         getMaxDataChangeExecutorQueueSize(), getMaxDataChangeListenerQueueSize(),
                         getMaxDataStoreExecutorQueueSize()));
index 4532452c65e32521dece928f5b20f00310f3c358..9358552579bb155d76357bbbdbbe7e94eab98f56 100644 (file)
@@ -23,7 +23,7 @@ public class InMemoryOperationalDataStoreProviderModule extends org.opendaylight
     @Override
     public java.lang.AutoCloseable createInstance() {
         InMemoryDOMDataStore dataStore = InMemoryDOMDataStoreFactory.create("DOM-OPER", getSchemaServiceDependency(),
-                InMemoryDOMDataStoreConfigProperties.create(getMaxDataChangeExecutorPoolSize(),
+                getDebugTransactions(), InMemoryDOMDataStoreConfigProperties.create(getMaxDataChangeExecutorPoolSize(),
                         getMaxDataChangeExecutorQueueSize(), getMaxDataChangeListenerQueueSize(),
                         getMaxDataStoreExecutorQueueSize()));
 
index 8a190c115fb2c68bd99228378ed389620af94023..6cc593904723ee6cf7a28f26fd0367703ec89371 100644 (file)
@@ -7,25 +7,26 @@
  */
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransaction;
-
 import com.google.common.base.Objects;
 import com.google.common.base.Objects.ToStringHelper;
 import com.google.common.base.Preconditions;
 
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransaction;
+import org.slf4j.Logger;
+
 /**
  * Abstract DOM Store Transaction
  *
  * Convenience super implementation of DOM Store transaction which provides
  * common implementation of {@link #toString()} and {@link #getIdentifier()}.
- *
- *
  */
 abstract class AbstractDOMStoreTransaction implements DOMStoreTransaction {
+    private final Throwable debugContext;
     private final Object identifier;
 
-    protected AbstractDOMStoreTransaction(final Object identifier) {
-        this.identifier = Preconditions.checkNotNull(identifier,"Identifier must not be null.");
+    protected AbstractDOMStoreTransaction(final Object identifier, final boolean debug) {
+        this.identifier = Preconditions.checkNotNull(identifier, "Identifier must not be null.");
+        this.debugContext = debug ? new Throwable().fillInStackTrace() : null;
     }
 
     @Override
@@ -33,6 +34,12 @@ abstract class AbstractDOMStoreTransaction implements DOMStoreTransaction {
         return identifier;
     }
 
+    protected final void warnDebugContext(final Logger logger) {
+        if (debugContext != null) {
+            logger.warn("Transaction {} has been allocated in the following context", identifier, debugContext);
+        }
+    }
+
     @Override
     public final String toString() {
         return addToStringAttributes(Objects.toStringHelper(this)).toString();
index 476356a19e79113b0b0121662b8842610757d12f..3e748618169889cdfcf0b9f8eb66c73e65cb4338 100644 (file)
@@ -16,14 +16,11 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
-
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
-
 import javax.annotation.concurrent.GuardedBy;
-
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
 import org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedException;
@@ -91,7 +88,7 @@ public class InMemoryDOMDataStore implements DOMStore, Identifiable<String>, Sch
     private final ExecutorService dataChangeListenerExecutor;
 
     private final ExecutorService domStoreExecutor;
-
+    private final boolean debugTransactions;
     private final String name;
 
     private volatile AutoCloseable closeable;
@@ -99,15 +96,17 @@ public class InMemoryDOMDataStore implements DOMStore, Identifiable<String>, Sch
     public InMemoryDOMDataStore(final String name, final ExecutorService domStoreExecutor,
             final ExecutorService dataChangeListenerExecutor) {
         this(name, domStoreExecutor, dataChangeListenerExecutor,
-             InMemoryDOMDataStoreConfigProperties.DEFAULT_MAX_DATA_CHANGE_LISTENER_QUEUE_SIZE);
+             InMemoryDOMDataStoreConfigProperties.DEFAULT_MAX_DATA_CHANGE_LISTENER_QUEUE_SIZE, false);
     }
 
     public InMemoryDOMDataStore(final String name, final ExecutorService domStoreExecutor,
-            final ExecutorService dataChangeListenerExecutor, final int maxDataChangeListenerQueueSize) {
+            final ExecutorService dataChangeListenerExecutor, final int maxDataChangeListenerQueueSize,
+            final boolean debugTransactions) {
         this.name = Preconditions.checkNotNull(name);
         this.domStoreExecutor = Preconditions.checkNotNull(domStoreExecutor);
         this.listeningExecutor = MoreExecutors.listeningDecorator(this.domStoreExecutor);
         this.dataChangeListenerExecutor = Preconditions.checkNotNull(dataChangeListenerExecutor);
+        this.debugTransactions = debugTransactions;
 
         dataChangeListenerNotificationManager =
                 new QueuedNotificationManager<>(this.dataChangeListenerExecutor,
@@ -134,17 +133,17 @@ public class InMemoryDOMDataStore implements DOMStore, Identifiable<String>, Sch
 
     @Override
     public DOMStoreReadTransaction newReadOnlyTransaction() {
-        return new SnapshotBackedReadTransaction(nextIdentifier(), dataTree.takeSnapshot());
+        return new SnapshotBackedReadTransaction(nextIdentifier(), debugTransactions, dataTree.takeSnapshot());
     }
 
     @Override
     public DOMStoreReadWriteTransaction newReadWriteTransaction() {
-        return new SnapshotBackedReadWriteTransaction(nextIdentifier(), dataTree.takeSnapshot(), this);
+        return new SnapshotBackedReadWriteTransaction(nextIdentifier(), debugTransactions, dataTree.takeSnapshot(), this);
     }
 
     @Override
     public DOMStoreWriteTransaction newWriteOnlyTransaction() {
-        return new SnapshotBackedWriteTransaction(nextIdentifier(), dataTree.takeSnapshot(), this);
+        return new SnapshotBackedWriteTransaction(nextIdentifier(), debugTransactions, dataTree.takeSnapshot(), this);
     }
 
     @Override
@@ -171,6 +170,10 @@ public class InMemoryDOMDataStore implements DOMStore, Identifiable<String>, Sch
         }
     }
 
+    boolean getDebugTransactions() {
+        return debugTransactions;
+    }
+
     @Override
     public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
             final YangInstanceIdentifier path, final L listener, final DataChangeScope scope) {
@@ -242,7 +245,7 @@ public class InMemoryDOMDataStore implements DOMStore, Identifiable<String>, Sch
             } else {
                 snapshot = dataTree.takeSnapshot();
             }
-            return new SnapshotBackedReadTransaction(nextIdentifier(), snapshot);
+            return new SnapshotBackedReadTransaction(nextIdentifier(), getDebugTransactions(), snapshot);
         }
 
         @Override
@@ -256,7 +259,7 @@ public class InMemoryDOMDataStore implements DOMStore, Identifiable<String>, Sch
                 snapshot = dataTree.takeSnapshot();
             }
             final SnapshotBackedReadWriteTransaction ret = new SnapshotBackedReadWriteTransaction(nextIdentifier(),
-                    snapshot, this);
+                    getDebugTransactions(), snapshot, this);
             latestOutstandingTx = ret;
             return ret;
         }
@@ -271,8 +274,8 @@ public class InMemoryDOMDataStore implements DOMStore, Identifiable<String>, Sch
             } else {
                 snapshot = dataTree.takeSnapshot();
             }
-            final SnapshotBackedWriteTransaction ret = new SnapshotBackedWriteTransaction(nextIdentifier(), snapshot,
-                    this);
+            final SnapshotBackedWriteTransaction ret = new SnapshotBackedWriteTransaction(nextIdentifier(),
+                    getDebugTransactions(), snapshot, this);
             latestOutstandingTx = ret;
             return ret;
         }
@@ -384,10 +387,12 @@ public class InMemoryDOMDataStore implements DOMStore, Identifiable<String>, Sch
                     } catch (ConflictingModificationAppliedException e) {
                         LOG.warn("Store Tx: {} Conflicting modification for {}.", transaction.getIdentifier(),
                                 e.getPath());
+                        transaction.warnDebugContext(LOG);
                         throw new OptimisticLockFailedException("Optimistic lock failed.",e);
                     } catch (DataValidationFailedException e) {
                         LOG.warn("Store Tx: {} Data Precondition failed for {}.", transaction.getIdentifier(),
                                 e.getPath(), e);
+                        transaction.warnDebugContext(LOG);
                         throw new TransactionCommitFailedException("Data did not pass validation.",e);
                     }
                 }
index 052fb2b89ba563c7be55612d75b48625f31de840..dc1482c6abaefb7880c7f6b55cc37c4d6ad65e3f 100644 (file)
@@ -5,13 +5,10 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
 import java.util.concurrent.ExecutorService;
-
 import javax.annotation.Nullable;
-
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.yangtools.util.concurrent.SpecialExecutors;
 
@@ -42,6 +39,22 @@ public final class InMemoryDOMDataStoreFactory {
     public static InMemoryDOMDataStore create(final String name,
             @Nullable final SchemaService schemaService,
             @Nullable final InMemoryDOMDataStoreConfigProperties properties) {
+        return create(name, schemaService, false, properties);
+    }
+
+    /**
+     * Creates an InMemoryDOMDataStore instance.
+     *
+     * @param name the name of the data store
+     * @param schemaService the SchemaService to which to register the data store.
+     * @param debugTransactions enable transaction debugging
+     * @param properties configuration properties for the InMemoryDOMDataStore instance. If null,
+     *                   default property values are used.
+     * @return an InMemoryDOMDataStore instance
+     */
+    public static InMemoryDOMDataStore create(final String name,
+            @Nullable final SchemaService schemaService, final boolean debugTransactions,
+            @Nullable final InMemoryDOMDataStoreConfigProperties properties) {
 
         InMemoryDOMDataStoreConfigProperties actualProperties = properties;
         if(actualProperties == null) {
@@ -64,7 +77,7 @@ public final class InMemoryDOMDataStoreFactory {
 
         InMemoryDOMDataStore dataStore = new InMemoryDOMDataStore(name,
                 domStoreExecutor, dataChangeListenerExecutor,
-                actualProperties.getMaxDataChangeListenerQueueSize());
+                actualProperties.getMaxDataChangeListenerQueueSize(), debugTransactions);
 
         if(schemaService != null) {
             schemaService.registerSchemaContextListener(dataStore);
index 2caa76d49dff02a34ad98232ccdc7db139f07f2c..ed95796499b3e9a6887d5708a76d636934aa9027 100644 (file)
@@ -7,10 +7,13 @@
  */
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
+
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -19,8 +22,6 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-
 /**
  *
  * Implementation of read-only transaction backed by {@link DataTreeSnapshot}
@@ -35,8 +36,8 @@ final class SnapshotBackedReadTransaction extends AbstractDOMStoreTransaction
     private static final Logger LOG = LoggerFactory.getLogger(SnapshotBackedReadTransaction.class);
     private volatile DataTreeSnapshot stableSnapshot;
 
-    public SnapshotBackedReadTransaction(final Object identifier, final DataTreeSnapshot snapshot) {
-        super(identifier);
+    public SnapshotBackedReadTransaction(final Object identifier, final boolean debug, final DataTreeSnapshot snapshot) {
+        super(identifier, debug);
         this.stableSnapshot = Preconditions.checkNotNull(snapshot);
         LOG.debug("ReadOnly Tx: {} allocated with snapshot {}", identifier, snapshot);
     }
@@ -66,7 +67,7 @@ final class SnapshotBackedReadTransaction extends AbstractDOMStoreTransaction
     }
 
     @Override
-    public CheckedFuture<Boolean, ReadFailedException> exists(YangInstanceIdentifier path) {
+    public CheckedFuture<Boolean, ReadFailedException> exists(final YangInstanceIdentifier path) {
         LOG.debug("Tx: {} Exists: {}", getIdentifier(), path);
         checkNotNull(path, "Path must not be null.");
 
index ce7043fd4747542a98802a893d0d49c3c12b3de5..2ae7425bbb9de443d4cdae61dc90dbc94ba61234 100644 (file)
@@ -9,19 +9,19 @@ package org.opendaylight.controller.md.sal.dom.store.impl;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.Futures;
+
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.Futures;
-
 /**
  * Implementation of Read-Write transaction which is backed by {@link DataTreeSnapshot}
  * and executed according to {@link TransactionReadyPrototype}.
@@ -39,9 +39,9 @@ class SnapshotBackedReadWriteTransaction extends SnapshotBackedWriteTransaction
      * @param snapshot Snapshot which will be modified.
      * @param readyImpl Implementation of ready method.
      */
-    protected SnapshotBackedReadWriteTransaction(final Object identifier, final DataTreeSnapshot snapshot,
-            final TransactionReadyPrototype store) {
-        super(identifier, snapshot, store);
+    protected SnapshotBackedReadWriteTransaction(final Object identifier, final boolean debug,
+            final DataTreeSnapshot snapshot, final TransactionReadyPrototype store) {
+        super(identifier, debug, snapshot, store);
     }
 
     @Override
@@ -62,8 +62,8 @@ class SnapshotBackedReadWriteTransaction extends SnapshotBackedWriteTransaction
         }
     }
 
-    @Override public CheckedFuture<Boolean, ReadFailedException> exists(
-        YangInstanceIdentifier path) {
+    @Override
+    public CheckedFuture<Boolean, ReadFailedException> exists(final YangInstanceIdentifier path) {
         try {
             return Futures.immediateCheckedFuture(
                 read(path).checkedGet().isPresent());
index 34532ab98fdc45502e3794a8ea967e4e3da4f805..6129df74787b2fdb8b2da30d9cc2c78f04b288bc 100644 (file)
@@ -9,20 +9,19 @@ package org.opendaylight.controller.md.sal.dom.store.impl;
 
 import static com.google.common.base.Preconditions.checkState;
 
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Throwables;
 
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Throwables;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-
 /**
  * Implementation of Write transaction which is backed by
  * {@link DataTreeSnapshot} and executed according to
@@ -46,9 +45,9 @@ class SnapshotBackedWriteTransaction extends AbstractDOMStoreTransaction impleme
      * @param readyImpl
      *            Implementation of ready method.
      */
-    public SnapshotBackedWriteTransaction(final Object identifier, final DataTreeSnapshot snapshot,
-            final TransactionReadyPrototype readyImpl) {
-        super(identifier);
+    public SnapshotBackedWriteTransaction(final Object identifier, final boolean debug,
+            final DataTreeSnapshot snapshot, final TransactionReadyPrototype readyImpl) {
+        super(identifier, debug);
         mutableTree = snapshot.newModification();
         this.readyImpl = Preconditions.checkNotNull(readyImpl, "readyImpl must not be null.");
         LOG.debug("Write Tx: {} allocated with snapshot {}", identifier, snapshot);
index 7d19a64446b519ea7795e86d81c6c431599ef7d9..5ffe4d60ca879c58e562557c1f4a78ce9638f7d6 100644 (file)
@@ -1,4 +1,3 @@
-
 module opendaylight-inmemory-datastore-provider {
 
     yang-version 1;
@@ -7,8 +6,8 @@ module opendaylight-inmemory-datastore-provider {
 
     import config { prefix config; revision-date 2013-04-05; }
     import rpc-context { prefix rpcx; revision-date 2013-06-17; }
-       import opendaylight-config-dom-datastore {prefix config-dom-store-spi;}
-       import opendaylight-operational-dom-datastore {prefix operational-dom-store-spi;}
+    import opendaylight-config-dom-datastore {prefix config-dom-store-spi;}
+    import opendaylight-operational-dom-datastore {prefix operational-dom-store-spi;}
     import opendaylight-md-sal-dom {prefix sal;}
 
     description
@@ -28,11 +27,11 @@ module opendaylight-inmemory-datastore-provider {
 
         // This is the definition of the service implementation as a module identity.
 
-     identity inmemory-operational-datastore-provider {
-             base config:module-type;
-             config:provided-service operational-dom-store-spi:operational-dom-datastore;
-             config:java-name-prefix InMemoryOperationalDataStoreProvider;
-      }
+    identity inmemory-operational-datastore-provider {
+            base config:module-type;
+            config:provided-service operational-dom-store-spi:operational-dom-datastore;
+            config:java-name-prefix InMemoryOperationalDataStoreProvider;
+    }
 
     grouping datastore-configuration {
             leaf max-data-change-executor-queue-size {
@@ -52,12 +51,16 @@ module opendaylight-inmemory-datastore-provider {
                 type uint16;
                 description "The maximum queue size for the data change listeners.";
             }
-
             leaf max-data-store-executor-queue-size {
                 default 5000;
                 type uint16;
                 description "The maximum queue size for the data store executor.";
             }
+            leaf debug-transactions {
+                type boolean;
+                default false;
+                description "Enable transaction lifecycle debugging.";
+            }
     }
 
     // Augments the 'configuration' choice node under modules/module.
index c609e13e791c375979ad99bce62ed27df9d321f8..04e19493dbb98051118553cd4573cc00d390bdd2 100644 (file)
@@ -7,10 +7,18 @@
  */
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
+
+import java.util.concurrent.ExecutionException;
+
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -32,13 +40,6 @@ import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
-import java.util.concurrent.ExecutionException;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
 
 public class InMemoryDataStoreTest {
 
@@ -271,7 +272,7 @@ public class InMemoryDataStoreTest {
         Mockito.doThrow( new RuntimeException( "mock ex" ) ).when( mockSnapshot )
         .readNode( Mockito.any( YangInstanceIdentifier.class ) );
 
-        DOMStoreReadTransaction readTx = new SnapshotBackedReadTransaction( "1", mockSnapshot );
+        DOMStoreReadTransaction readTx = new SnapshotBackedReadTransaction("1", true, mockSnapshot);
 
         doReadAndThrowEx( readTx );
     }
@@ -296,12 +297,12 @@ public class InMemoryDataStoreTest {
         .readNode( Mockito.any( YangInstanceIdentifier.class ) );
         Mockito.doReturn( mockModification ).when( mockSnapshot ).newModification();
         TransactionReadyPrototype mockReady = Mockito.mock( TransactionReadyPrototype.class );
-        DOMStoreReadTransaction readTx = new SnapshotBackedReadWriteTransaction( "1", mockSnapshot, mockReady );
+        DOMStoreReadTransaction readTx = new SnapshotBackedReadWriteTransaction("1", false, mockSnapshot, mockReady);
 
         doReadAndThrowEx( readTx );
     }
 
-    private void doReadAndThrowEx( DOMStoreReadTransaction readTx ) throws Throwable {
+    private void doReadAndThrowEx( final DOMStoreReadTransaction readTx ) throws Throwable {
 
         try {
             readTx.read(TestModel.TEST_PATH).get();