Skip to content

Commit

Permalink
close old connection when opening a new one
Browse files Browse the repository at this point in the history
  • Loading branch information
John Corwin committed Oct 19, 2010
1 parent b4729db commit 1f34e2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion project/build.properties
Expand Up @@ -3,7 +3,7 @@
project.organization=com.twitter
project.name=zookeeper-client
scala.version=2.7.7
project.version=1.5.1
project.version=1.5.2
sbt.version=0.7.4
def.scala.version=2.7.7
build.scala.versions=2.7.7
Expand Down
4 changes: 4 additions & 0 deletions src/main/scala/com/twitter/zookeeper/ZooKeeperClient.scala
Expand Up @@ -46,6 +46,10 @@ class ZooKeeperClient(servers: String, sessionTimeout: Int, basePath : String,
private def connect() {
val connectionLatch = new CountDownLatch(1)
val assignLatch = new CountDownLatch(1)
if (zk != null) {
zk.close()
zk = null
}
zk = new ZooKeeper(servers, sessionTimeout,
new Watcher { def process(event : WatchedEvent) {
sessionEvent(assignLatch, connectionLatch, event)
Expand Down

0 comments on commit 1f34e2f

Please sign in to comment.