Move transaction-invariants into producer
[mdsal.git] / dom / mdsal-dom-inmemory-datastore / src / main / java / org / opendaylight / mdsal / dom / store / inmemory / InMemoryDOMDataTreeShardProducer.java
index 348c46df337054a91fa8f5907d3c86c238f0eed0..f2b5ac042745e8bbf7a0287a8d2a067e95a94806 100644 (file)
@@ -103,10 +103,13 @@ class InMemoryDOMDataTreeShardProducer implements DOMDataTreeShardProducer {
             AtomicReferenceFieldUpdater.newUpdater(InMemoryDOMDataTreeShardProducer.class, State.class, "state");
     private volatile State state;
 
+    private ShardDataModificationFactory modificationFactory;
+
     InMemoryDOMDataTreeShardProducer(final InMemoryDOMDataTreeShard parentShard,
-            final Collection<DOMDataTreeIdentifier> prefixes) {
+        final Collection<DOMDataTreeIdentifier> prefixes, final ShardDataModificationFactory modificationFactory) {
         this.parentShard = Preconditions.checkNotNull(parentShard);
         this.prefixes = ImmutableSet.copyOf(prefixes);
+        this.modificationFactory = Preconditions.checkNotNull(modificationFactory);
         state = idleState;
     }
 
@@ -118,7 +121,7 @@ class InMemoryDOMDataTreeShardProducer implements DOMDataTreeShardProducer {
         InmemoryDOMDataTreeShardWriteTransaction ret;
         do {
             localState = state;
-            ret = parentShard.createTransaction(transactionId, this, prefixes, localState.getSnapshot(transactionId));
+            ret = parentShard.createTransaction(transactionId, this, localState.getSnapshot(transactionId));
         } while (!STATE_UPDATER.compareAndSet(this, localState, new Allocated(ret)));
 
         return ret;
@@ -197,4 +200,12 @@ class InMemoryDOMDataTreeShardProducer implements DOMDataTreeShardProducer {
     public Collection<DOMDataTreeIdentifier> getPrefixes() {
         return prefixes;
     }
+
+    ShardDataModificationFactory getModificationFactory() {
+        return modificationFactory;
+    }
+
+    void setModificationFactory(final ShardDataModificationFactory modificationFactory) {
+        this.modificationFactory = Preconditions.checkNotNull(modificationFactory);
+    }
 }