Skip to content

Commit

Permalink
Fix it #108
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaopeng-he committed Mar 20, 2017
1 parent 968b450 commit ea47ea8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
16 changes: 4 additions & 12 deletions saturn-it/src/test/java/com/vip/saturn/it/utils/NestedZkUtils.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.vip.saturn.it.utils;

import java.io.IOException;
import java.net.ServerSocket;

import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.RetryNTimes;
Expand All @@ -12,6 +9,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.net.ServerSocket;

/**
* @author dylan.xue
*/
Expand Down Expand Up @@ -62,7 +62,7 @@ public void killSession(ZooKeeper client) throws Exception {

public CuratorFramework createClient(String namespace) throws InterruptedException {
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
CuratorFramework curatorFramework = builder.connectString("localhost:" + PORT)
CuratorFramework curatorFramework = builder.connectString("127.0.0.1:" + PORT)
.sessionTimeoutMs(600 * 1000) // long long, could to debug
.retryPolicy(new RetryNTimes(3, 1000))
.namespace(namespace)
Expand All @@ -72,12 +72,4 @@ public CuratorFramework createClient(String namespace) throws InterruptedExcepti
return curatorFramework;
}

public static void main(String[] args) throws Exception {
NestedZkUtils nestedZkUtils = new NestedZkUtils();
nestedZkUtils.startServer();
CuratorFramework client = nestedZkUtils.createClient("abc");
Thread.sleep(1 * 1000);
KillSession.kill(client.getZookeeperClient().getZooKeeper(), nestedZkUtils.getZkString());
Thread.sleep(10 * 1000);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void stopServer() throws IOException {

public CuratorFramework createClient(String namespace) throws InterruptedException {
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
CuratorFramework curatorFramework = builder.connectString("localhost:" + port)
CuratorFramework curatorFramework = builder.connectString("127.0.0.1:" + port)
.sessionTimeoutMs(600 * 1000) // long long, could to debug
.retryPolicy(new RetryNTimes(3, 1000))
.namespace(namespace)
Expand Down

0 comments on commit ea47ea8

Please sign in to comment.