{"action":"closed","issue":{"url":"https://api.github.com/repos/eirslett/thrift-zookeeper/issues/1","repository_url":"https://api.github.com/repos/eirslett/thrift-zookeeper","labels_url":"https://api.github.com/repos/eirslett/thrift-zookeeper/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/eirslett/thrift-zookeeper/issues/1/comments","events_url":"https://api.github.com/repos/eirslett/thrift-zookeeper/issues/1/events","html_url":"https://github.com/eirslett/thrift-zookeeper/issues/1","id":107656135,"number":1,"title":"do you the finagle new api for zk?","user":{"login":"3thinkthendoit","id":13362524,"avatar_url":"https://avatars.githubusercontent.com/u/13362524?v=3","gravatar_id":"","url":"https://api.github.com/users/3thinkthendoit","html_url":"https://github.com/3thinkthendoit","followers_url":"https://api.github.com/users/3thinkthendoit/followers","following_url":"https://api.github.com/users/3thinkthendoit/following{/other_user}","gists_url":"https://api.github.com/users/3thinkthendoit/gists{/gist_id}","starred_url":"https://api.github.com/users/3thinkthendoit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3thinkthendoit/subscriptions","organizations_url":"https://api.github.com/users/3thinkthendoit/orgs","repos_url":"https://api.github.com/users/3thinkthendoit/repos","events_url":"https://api.github.com/users/3thinkthendoit/events{/privacy}","received_events_url":"https://api.github.com/users/3thinkthendoit/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2015-09-22T06:52:56Z","updated_at":"2016-12-16T14:30:09Z","closed_at":"2016-12-16T14:30:09Z","body":"like this \n\n //#thriftclientapi\n    Hello.ServiceIface client = Thrift.newIface(\"localhost:8080\", Hello.ServiceIface.class);\n    Future<String> response = client.hello().onSuccess(new Function<String, BoxedUnit>() {\n      @Override\n      public BoxedUnit apply(String response) {\n        System.out.println(\"Received response: \" + response);\n        return null;\n      }\n    });\n\n   // response.raiseWithin(1.ms, timer)\n    Await.result(response);\n\nthe zookeeper code \n String zkPath = \"/foo/bar/baz\";\n       ZkClientFactory cf = new ZkClientFactory(Duration.apply(5, TimeUnit.SECONDS));//10 seconds  \n       ZkResolver zk  = new ZkResolver(cf);\n       InetSocketAddress zookeeperAddress = new InetSocketAddress(\"192.168.115.105\", 2181);\n       ZooKeeperClient zookeeperClient = new ZooKeeperClient(Amount.of(10, Time.MILLISECONDS),zookeeperAddress);\n       ServerSetImpl serverSet = new ServerSetImpl(zookeeperClient, zkPath);\n       //add the servie to zookeeper\n       InetSocketAddress endpoint1 = new InetSocketAddress(\"10.50.101.133\", 1080);\n       InetSocketAddress endpoint2 = new InetSocketAddress(\"10.50.101.133\", 2090);\n       try {\n           EndpointStatus  status1 = serverSet.join(endpoint1, new HashMap<String,InetSocketAddress>(),Status.ALIVE);\n           EndpointStatus  status2 = serverSet.join(endpoint2, new HashMap<String,InetSocketAddress>(),Status.ALIVE);\n           ZkGroup cluster = new ZkGroup(serverSet, zkPath);// for client cluster ，get node info from zookeeper\n           scala.collection.immutable.Set<ServiceInstance> set =  cluster.apply();\n           System.out.println(set.size());\n       } catch (JoinException e) {\n            e.printStackTrace();\n       } catch (InterruptedException e) {\n            e.printStackTrace();\n       }finally{\n           zookeeperClient.close();\n       }\n"}}
{"actor":{"display_login":"eirslett"}}