Notify listeners on applySnapshot
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / ShardDataTree.java
index 72ca1aebd8e1723a2a0c86de0ed2a9e7d250d544..bf3b200825bc0c07c2283e7ceaf5d0c25363561a 100644 (file)
@@ -208,7 +208,10 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
 
         final DataTreeModification unwrapped = unwrap(mod);
         dataTree.validate(unwrapped);
-        dataTree.commit(dataTree.prepare(unwrapped));
+        DataTreeCandidateTip candidate = dataTree.prepare(unwrapped);
+        dataTree.commit(candidate);
+        notifyListeners(candidate);
+
         LOG.debug("{}: state snapshot applied in %s", logContext, elapsed);
     }
 
@@ -283,7 +286,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         } else if (payload instanceof DataTreeCandidatePayload) {
             applyRecoveryCandidate(((DataTreeCandidatePayload) payload).getCandidate());
         } else {
-            LOG.warn("{}: ignoring unhandled payload {}", logContext, payload);
+            LOG.debug("{}: ignoring unhandled payload {}", logContext, payload);
         }
     }
 
@@ -388,6 +391,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         return ensureTransactionChain(txId.getHistoryId()).newReadWriteTransaction(txId);
     }
 
+    @VisibleForTesting
     public void notifyListeners(final DataTreeCandidate candidate) {
         treeChangeListenerPublisher.publishChanges(candidate, logContext);
         dataChangeListenerPublisher.publishChanges(candidate, logContext);
@@ -474,10 +478,11 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         return dataTree.takeSnapshot().readNode(path);
     }
 
-    public DataTreeSnapshot takeSnapshot() {
+    DataTreeSnapshot takeSnapshot() {
         return dataTree.takeSnapshot();
     }
 
+    @VisibleForTesting
     public DataTreeModification newModification() {
         return dataTree.takeSnapshot().newModification();
     }