Madan Jampani
Committed by Gerrit Code Review

Fix PartitionedAsyncLeaderElector to ensure status change listeners are properly handled

Change-Id: I9fa1268ba07734130ab7618e2110c053499bf1f1
(cherry picked from commit a82b2171)
...@@ -28,7 +28,6 @@ import org.onosproject.cluster.NodeId; ...@@ -28,7 +28,6 @@ import org.onosproject.cluster.NodeId;
28 import org.onosproject.cluster.PartitionId; 28 import org.onosproject.cluster.PartitionId;
29 import org.onosproject.event.Change; 29 import org.onosproject.event.Change;
30 import org.onosproject.store.service.AsyncLeaderElector; 30 import org.onosproject.store.service.AsyncLeaderElector;
31 -
32 import com.google.common.collect.Maps; 31 import com.google.common.collect.Maps;
33 32
34 /** 33 /**
...@@ -126,4 +125,19 @@ public class PartitionedAsyncLeaderElector implements AsyncLeaderElector { ...@@ -126,4 +125,19 @@ public class PartitionedAsyncLeaderElector implements AsyncLeaderElector {
126 private Collection<AsyncLeaderElector> getLeaderElectors() { 125 private Collection<AsyncLeaderElector> getLeaderElectors() {
127 return partitions.values(); 126 return partitions.values();
128 } 127 }
128 +
129 + @Override
130 + public void addStatusChangeListener(Consumer<Status> listener) {
131 + partitions.values().forEach(elector -> elector.addStatusChangeListener(listener));
132 + }
133 +
134 + @Override
135 + public void removeStatusChangeListener(Consumer<Status> listener) {
136 + partitions.values().forEach(elector -> elector.removeStatusChangeListener(listener));
137 + }
138 +
139 + @Override
140 + public Collection<Consumer<Status>> statusChangeListeners() {
141 + throw new UnsupportedOperationException();
142 + }
129 } 143 }
...\ No newline at end of file ...\ No newline at end of file
......