use of org.apache.curator.retry.RetryNTimes in project drill by axbaretto.
the class TestZookeeperClient method setUp.
@Before
public void setUp() throws Exception {
ZookeeperTestUtil.setZookeeperSaslTestConfigProps();
server = new TestingServer();
final RetryPolicy policy = new RetryNTimes(1, 1000);
curator = CuratorFrameworkFactory.newClient(server.getConnectString(), policy);
client = new ClientWithMockCache(curator, root, mode);
server.start();
curator.start();
client.start();
}
use of org.apache.curator.retry.RetryNTimes in project drill by axbaretto.
the class TestPStoreProviders method createCurator.
private CuratorFramework createCurator() {
String connect = zkHelper.getConnectionString();
DrillConfig config = zkHelper.getConfig();
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder().namespace(zkHelper.getConfig().getString(ExecConstants.ZK_ROOT)).retryPolicy(new RetryNTimes(1, 100)).connectionTimeoutMs(config.getInt(ExecConstants.ZK_TIMEOUT)).connectString(connect);
return builder.build();
}
use of org.apache.curator.retry.RetryNTimes in project drill by axbaretto.
the class TestZkRegistry method connectToZk.
/**
* Connect to the test ZK for the simulated Drillbit side of the test. (The AM
* side of the test uses the actual AM code, which is what we're testing
* here...)
*
* @param connectString
* @return
*/
public static CuratorFramework connectToZk(String connectString) {
CuratorFramework client = CuratorFrameworkFactory.builder().namespace(ZK_ROOT + "/" + CLUSTER_ID).connectString(connectString).retryPolicy(new RetryNTimes(3, 1000)).build();
client.start();
return client;
}
use of org.apache.curator.retry.RetryNTimes in project x-pipe by ctripcorp.
the class MetaServerPrepareResourcesAndStart method connectToZk.
private CuratorFramework connectToZk(String connectString) throws InterruptedException {
Builder builder = CuratorFrameworkFactory.builder();
builder.connectionTimeoutMs(3000);
builder.connectString(connectString);
builder.maxCloseWaitMs(3000);
builder.namespace("xpipe");
builder.retryPolicy(new RetryNTimes(3, 1000));
builder.sessionTimeoutMs(5000);
CuratorFramework client = builder.build();
client.start();
client.blockUntilConnected();
return client;
}
use of org.apache.curator.retry.RetryNTimes in project x-pipe by ctripcorp.
the class DefaultZkConfig method create.
@Override
public CuratorFramework create(String address) throws InterruptedException {
Builder builder = CuratorFrameworkFactory.builder();
builder.connectionTimeoutMs(getZkConnectionTimeoutMillis());
builder.connectString(address);
builder.maxCloseWaitMs(getZkCloseWaitMillis());
builder.namespace(getZkNamespace());
builder.retryPolicy(new RetryNTimes(getZkRetries(), getSleepMsBetweenRetries()));
builder.sessionTimeoutMs(getZkSessionTimeoutMillis());
builder.threadFactory(XpipeThreadFactory.create("Xpipe-ZK-" + address, true));
logger.info("[create]{}, {}", Codec.DEFAULT.encode(this), address);
CuratorFramework curatorFramework = builder.build();
curatorFramework.start();
curatorFramework.blockUntilConnected(waitForZkConnectedMillis(), TimeUnit.MILLISECONDS);
return curatorFramework;
}
Aggregations