Fixes a RuntimeException thrown when we try and take control of a switch we're already contending
diff --git a/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java b/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java
index 51335fe..025bbfe 100644
--- a/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java
+++ b/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java
@@ -208,8 +208,10 @@
String latchPath = switchLatchesPath + "/" + dpidStr;
if (switchLatches.get(dpidStr) != null){
- throw new RuntimeException("Leader election for switch " + dpidStr +
- "is already running");
+ //throw new RuntimeException("Leader election for switch " + dpidStr +
+ // "is already running");
+ log.debug("Already contesting {}, returning", HexString.toHexString(dpid));
+ return;
}
LeaderLatch latch = new LeaderLatch(client, latchPath, controllerId);