Ayaka Koshibe
Committed by Gerrit Code Review

Fix NPE for election app when handling CANDIDATE events. Also disables running

for leadership automatically at startup.

Change-Id: I27f297fdd4b62f9cd345df88a772f76ade56d350
......@@ -68,7 +68,6 @@ public class ElectionTest {
localControllerNode = clusterService.getLocalNode();
leadershipService.addListener(leadershipEventListener);
leadershipService.runForLeadership(appId.name());
}
@Deactivate
......@@ -90,6 +89,9 @@ public class ElectionTest {
public void event(LeadershipEvent event) {
if (event.type().equals(LeadershipEvent.Type.CANDIDATES_CHANGED)) {
return;
}
if (!event.subject().topic().equals(appId.name())) {
return; // Not our topic: ignore
}
......