X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fentityownership%2FCandidateListChangeListener.java;h=833ca30e31412f8ac159933a02d40e27e50eb05d;hb=d5bd70b3350fa21bb007e0ad9492d8cc6475ac98;hp=bd41ebe94292a00d13097fc86251f39edead582e;hpb=a4d9810d7211097f2803174d0c23a27b53dbc9d2;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/CandidateListChangeListener.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/CandidateListChangeListener.java index bd41ebe942..833ca30e31 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/CandidateListChangeListener.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/CandidateListChangeListener.java @@ -66,8 +66,9 @@ class CandidateListChangeListener implements DOMDataTreeChangeListener { public void onDataTreeChanged(Collection changes) { for(DataTreeCandidate change: changes) { DataTreeCandidateNode changeRoot = change.getRootNode(); + ModificationType type = changeRoot.getModificationType(); - LOG.debug("{}: Candidate node changed: {}, {}", logId, changeRoot.getModificationType(), change.getRootPath()); + LOG.debug("{}: Candidate node changed: {}, {}", logId, type, change.getRootPath()); NodeIdentifierWithPredicates candidateKey = (NodeIdentifierWithPredicates) change.getRootPath().getLastPathArgument(); @@ -75,12 +76,12 @@ class CandidateListChangeListener implements DOMDataTreeChangeListener { YangInstanceIdentifier entityId = extractEntityPath(change.getRootPath()); - if(changeRoot.getModificationType() == ModificationType.WRITE) { + if(type == ModificationType.WRITE || type == ModificationType.APPEARED) { LOG.debug("{}: Candidate {} was added for entity {}", logId, candidate, entityId); Collection currentCandidates = addToCurrentCandidates(entityId, candidate); shard.tell(new CandidateAdded(entityId, candidate, new ArrayList<>(currentCandidates)), shard); - } else if(changeRoot.getModificationType() == ModificationType.DELETE) { + } else if(type == ModificationType.DELETE || type == ModificationType.DISAPPEARED) { LOG.debug("{}: Candidate {} was removed for entity {}", logId, candidate, entityId); Collection currentCandidates = removeFromCurrentCandidates(entityId, candidate); @@ -111,7 +112,7 @@ class CandidateListChangeListener implements DOMDataTreeChangeListener { return Collections.emptyList(); } - private YangInstanceIdentifier extractEntityPath(YangInstanceIdentifier candidatePath) { + private static YangInstanceIdentifier extractEntityPath(YangInstanceIdentifier candidatePath) { List newPathArgs = new ArrayList<>(); for(PathArgument pathArg: candidatePath.getPathArguments()) { newPathArgs.add(pathArg); @@ -126,4 +127,4 @@ class CandidateListChangeListener implements DOMDataTreeChangeListener { return YangInstanceIdentifier.create(newPathArgs); } -} \ No newline at end of file +}