Search in sources :

Example 26 with ZkClient

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);
}
Also used : ZkClient(org.I0Itec.zkclient.ZkClient) ZkConfig(org.apache.samza.config.ZkConfig)

Example 27 with ZkClient

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);
}
Also used : ZkClient(org.I0Itec.zkclient.ZkClient) Before(org.junit.Before)

Example 28 with ZkClient

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();
}
Also used : ZkClient(org.I0Itec.zkclient.ZkClient) ZkNodeExistsException(org.I0Itec.zkclient.exception.ZkNodeExistsException) ZkConnection(org.I0Itec.zkclient.ZkConnection) SamzaException(org.apache.samza.SamzaException) ZkNodeExistsException(org.I0Itec.zkclient.exception.ZkNodeExistsException) Before(org.junit.Before)

Aggregations

ZkClient (org.I0Itec.zkclient.ZkClient)28 Properties (java.util.Properties)8 ZkUtils (kafka.utils.ZkUtils)7 ZkConnection (org.I0Itec.zkclient.ZkConnection)6 Before (org.junit.Before)6 File (java.io.File)4 IOException (java.io.IOException)4 InputStream (java.io.InputStream)4 KafkaConfig (kafka.server.KafkaConfig)4 DateTime (org.joda.time.DateTime)3 PinotHelixResourceManager (com.linkedin.pinot.controller.helix.core.PinotHelixResourceManager)2 URL (com.weibo.api.motan.rpc.URL)2 ISE (io.druid.java.util.common.ISE)2 TopicExistsException (kafka.common.TopicExistsException)2 MockTime (kafka.utils.MockTime)2 Time (kafka.utils.Time)2 EmbeddedZookeeper (kafka.zk.EmbeddedZookeeper)2 IDefaultNameSpace (org.I0Itec.zkclient.IDefaultNameSpace)2 ZkServer (org.I0Itec.zkclient.ZkServer)2 TestingServer (org.apache.curator.test.TestingServer)2