use of org.I0Itec.zkclient.ZkClient in project samza by apache.
the class ZkCoordinationServiceFactory method getCoordinationService.
// TODO - Why should this method be synchronized?
public synchronized CoordinationUtils getCoordinationService(String groupId, String participantId, Config config) {
ZkConfig zkConfig = new ZkConfig(config);
ZkClient zkClient = createZkClient(zkConfig.getZkConnect(), zkConfig.getZkSessionTimeoutMs(), zkConfig.getZkConnectionTimeoutMs());
// make sure the 'path' exists
createZkPath(zkConfig.getZkConnect(), zkClient);
ZkUtils zkUtils = new ZkUtils(new ZkKeyBuilder(groupId), zkClient, zkConfig.getZkConnectionTimeoutMs());
return new ZkCoordinationUtils(participantId, zkConfig, zkUtils);
}
use of org.I0Itec.zkclient.ZkClient in project samza by apache.
the class TestZkBarrierForVersionUpgrade method testSetup.
@Before
public void testSetup() {
ZkClient zkClient = new ZkClient(testZkConnectionString, ZkConfig.DEFAULT_SESSION_TIMEOUT_MS, ZkConfig.DEFAULT_CONNECTION_TIMEOUT_MS);
this.zkUtils = new ZkUtils(new ZkKeyBuilder("group1"), zkClient, ZkConfig.DEFAULT_CONNECTION_TIMEOUT_MS);
ZkClient zkClient1 = new ZkClient(testZkConnectionString, ZkConfig.DEFAULT_SESSION_TIMEOUT_MS, ZkConfig.DEFAULT_CONNECTION_TIMEOUT_MS);
this.zkUtils1 = new ZkUtils(new ZkKeyBuilder("group1"), zkClient1, ZkConfig.DEFAULT_CONNECTION_TIMEOUT_MS);
}
use of org.I0Itec.zkclient.ZkClient in project samza by apache.
the class TestZkUtils method testSetup.
@Before
public void testSetup() {
try {
zkClient = new ZkClient(new ZkConnection("127.0.0.1:" + zkServer.getPort(), SESSION_TIMEOUT_MS), CONNECTION_TIMEOUT_MS);
} catch (Exception e) {
Assert.fail("Client connection setup failed. Aborting tests..");
}
try {
zkClient.createPersistent(KEY_BUILDER.getProcessorsPath(), true);
} catch (ZkNodeExistsException e) {
// Do nothing
}
zkUtils = new ZkUtils(KEY_BUILDER, zkClient, SESSION_TIMEOUT_MS);
zkUtils.connect();
}
Aggregations