commit | a8a329c767c9c25f255942f75e5564076b191111 | [log] [tgz] |
---|---|---|
author | jaegonkim <jaegon77.kim@samsung.com> | Wed Apr 04 23:00:52 2018 +0900 |
committer | Charles Chan <rascov@gmail.com> | Mon Apr 09 14:10:35 2018 -0400 |
tree | 862556465a4a7c56e8f17b0f264bc0f93927cda6 | |
parent | 8a4de9195ce2dee5d40220d6964aefda6d73417f [diff] |
[ONOS-7586] ONOS leadership change does not occurs sometimes. Change-Id: Ifa1999c7ce0601fc65cad22af753b78c43b5da0c
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorService.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorService.java index 5afa954..e330c32 100644 --- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorService.java +++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorService.java
@@ -353,16 +353,16 @@ private void onSessionEnd(RaftSession session) { listeners.remove(session.sessionId().id()); - Set<String> topics = elections.keySet(); + Set<String> topics = ImmutableSet.copyOf(elections.keySet()); List<Change<Leadership>> changes = Lists.newArrayList(); - topics.forEach(topic -> { + for (String topic: topics) { Leadership oldLeadership = leadership(topic); elections.compute(topic, (k, v) -> v.cleanup(topic, session, termCounter(topic)::incrementAndGet)); Leadership newLeadership = leadership(topic); if (!Objects.equal(oldLeadership, newLeadership)) { changes.add(new Change<>(oldLeadership, newLeadership)); } - }); + } notifyLeadershipChanges(changes); }