Search in sources :

Example 1 with ZkClient

use of com.ctrip.xpipe.zk.ZkClient in project x-pipe by ctripcorp.

the class AbstractMetaServerClusterTest method getCuratorFramework.

protected CuratorFramework getCuratorFramework(int zkPort) throws Exception {
    ZkClient client = new DefaultZkClient();
    client.setZkAddress(String.format("localhost:%d", zkPort));
    LifecycleHelper.initializeIfPossible(client);
    LifecycleHelper.startIfPossible(client);
    return client.get();
}
Also used : DefaultZkClient(com.ctrip.xpipe.zk.impl.DefaultZkClient) ZkClient(com.ctrip.xpipe.zk.ZkClient) DefaultZkClient(com.ctrip.xpipe.zk.impl.DefaultZkClient)

Example 2 with ZkClient

use of com.ctrip.xpipe.zk.ZkClient in project x-pipe by ctripcorp.

the class MetaServerPrepareResourcesAndStart method setupResouces.

private ApplicationContext setupResouces(DcMeta dcMeta) throws Exception {
    ApplicationContext applicationContext = SpringComponentLifecycleManager.getApplicationContext();
    logger.info("[setupResouces][set zkConnectionString]");
    ZkClient zkClient = applicationContext.getBean(ZkClient.class);
    zkClient.setZkAddress(zkAddress);
    logger.info("[setupResouces][start MetaServerLifecycleManager]");
    SpringComponentLifecycleManager metaServerLifecycleManager = applicationContext.getBean(SpringComponentLifecycleManager.class);
    metaServerLifecycleManager.startAll();
    return applicationContext;
}
Also used : ZkClient(com.ctrip.xpipe.zk.ZkClient) ApplicationContext(org.springframework.context.ApplicationContext) SpringComponentLifecycleManager(com.ctrip.xpipe.lifecycle.SpringComponentLifecycleManager)

Aggregations

ZkClient (com.ctrip.xpipe.zk.ZkClient)2 SpringComponentLifecycleManager (com.ctrip.xpipe.lifecycle.SpringComponentLifecycleManager)1 DefaultZkClient (com.ctrip.xpipe.zk.impl.DefaultZkClient)1 ApplicationContext (org.springframework.context.ApplicationContext)1