Merged in changes from master - bug fixes
diff --git a/build.xml b/build.xml
index e8055e7..1b36535 100644
--- a/build.xml
+++ b/build.xml
@@ -66,9 +66,9 @@
<include name="concurrentlinkedhashmap-lru-1.3.jar"/>
<include name="jython-2.5.2.jar"/>
<include name="libthrift-0.7.0.jar"/>
- <include name="curator-client-1.3.3.jar"/>
- <include name="curator-framework-1.3.3.jar"/>
- <include name="curator-recipes-1.3.3.jar"/>
+ <include name="curator-client-1.3.4-SNAPSHOT.jar"/>
+ <include name="curator-framework-1.3.4-SNAPSHOT.jar"/>
+ <include name="curator-recipes-1.3.4-SNAPSHOT.jar"/>
<include name="zookeeper-3.4.5.jar"/>
</patternset>
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 025bbfe..c9ed160 100644
--- a/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java
+++ b/src/main/java/net/onrc/onos/registry/controller/ZookeeperRegistry.java
@@ -33,6 +33,8 @@
import com.netflix.curator.framework.recipes.cache.PathChildrenCacheEvent;
import com.netflix.curator.framework.recipes.cache.PathChildrenCacheListener;
import com.netflix.curator.framework.recipes.leader.LeaderLatch;
+import com.netflix.curator.framework.recipes.leader.LeaderLatchEvent;
+import com.netflix.curator.framework.recipes.leader.LeaderLatchListener;
import com.netflix.curator.framework.recipes.leader.Participant;
import com.netflix.curator.retry.ExponentialBackoffRetry;
@@ -150,6 +152,24 @@
}
}
+ protected class ParamaterizedLeaderListener implements LeaderLatchListener{
+ String dpid;
+ LeaderLatch latch;
+
+ public ParamaterizedLeaderListener(String dpid, LeaderLatch latch){
+ this.dpid = dpid;
+ this.latch = latch;
+ }
+
+ @Override
+ public void leaderLatchEvent(CuratorFramework arg0,
+ LeaderLatchEvent arg1) {
+ log.debug("Got leader latch event for {} hasLeadership {}",
+ dpid, latch.hasLeadership());
+
+ }
+ }
+
/**
* Listens for changes to the switch znodes in Zookeeper. This maintains
@@ -218,11 +238,13 @@
switchLatches.put(dpidStr, latch);
switchCallbacks.put(dpidStr, cb);
+ latch.addListener(new ParamaterizedLeaderListener(dpidStr, latch));
+
try {
//client.getChildren().usingWatcher(watcher).inBackground().forPath(singleLatchPath);
- client.getChildren().usingWatcher(
- new ParamaterizedCuratorWatcher(dpidStr, latchPath))
- .inBackground().forPath(latchPath);
+ //client.getChildren().usingWatcher(
+ // new ParamaterizedCuratorWatcher(dpidStr, latchPath))
+ // .inBackground().forPath(latchPath);
latch.start();
} catch (Exception e) {
log.warn("Error starting leader latch: {}", e.getMessage());