Do not leak DataTree from backend actor
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / LocalTransactionFactoryImpl.java
index 78046bce9be123b423b6e50d61dd79cd83f9027f..8c8444902550230d76d11e19763f5f93f3c2ba20 100644 (file)
@@ -20,8 +20,8 @@ import org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction;
 import org.opendaylight.mdsal.dom.spi.store.SnapshotBackedTransactions;
 import org.opendaylight.mdsal.dom.spi.store.SnapshotBackedWriteTransaction;
 import org.opendaylight.mdsal.dom.spi.store.SnapshotBackedWriteTransaction.TransactionReadyPrototype;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.ReadOnlyDataTree;
 
 /**
  * {@link LocalTransactionFactory} for instantiating backing transactions which are
@@ -32,16 +32,17 @@ final class LocalTransactionFactoryImpl extends TransactionReadyPrototype<Transa
         implements LocalTransactionFactory {
 
     private final ActorSelection leader;
-    private final DataTree dataTree;
+    private final ReadOnlyDataTree dataTree;
     private final ActorUtils actorUtils;
 
-    LocalTransactionFactoryImpl(final ActorUtils actorUtils, final ActorSelection leader, final DataTree dataTree) {
+    LocalTransactionFactoryImpl(final ActorUtils actorUtils, final ActorSelection leader,
+            final ReadOnlyDataTree dataTree) {
         this.leader = requireNonNull(leader);
         this.dataTree = requireNonNull(dataTree);
         this.actorUtils = actorUtils;
     }
 
-    DataTree getDataTree() {
+    ReadOnlyDataTree getDataTree() {
         return dataTree;
     }