Search in sources :

Example 21 with RetryOneTime

use of org.apache.curator.retry.RetryOneTime in project druid by druid-io.

the class CuratorTestBase method setupServerAndCurator.

protected void setupServerAndCurator() throws Exception {
    server = new TestingServer();
    timing = new Timing();
    curator = CuratorFrameworkFactory.builder().connectString(server.getConnectString()).sessionTimeoutMs(timing.session()).connectionTimeoutMs(timing.connection()).retryPolicy(new RetryOneTime(1)).compressionProvider(new PotentiallyGzippedCompressionProvider(true)).build();
}
Also used : TestingServer(org.apache.curator.test.TestingServer) RetryOneTime(org.apache.curator.retry.RetryOneTime) Timing(org.apache.curator.test.Timing)

Example 22 with RetryOneTime

use of org.apache.curator.retry.RetryOneTime in project zipkin by openzipkin.

the class ZooKeeperRule method doEvaluate.

void doEvaluate(Statement base) throws Throwable {
    try {
        cluster = new TestingCluster(3);
        cluster.start();
        client = newClient(cluster.getConnectString(), new RetryOneTime(200));
        client.start();
        checkState(client.blockUntilConnected(5, TimeUnit.SECONDS), "failed to connect to zookeeper in 5 seconds");
        base.evaluate();
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new IllegalStateException("Interrupted while connecting to ZooKeeper", e);
    } finally {
        client.close();
        cluster.close();
    }
}
Also used : TestingCluster(org.apache.curator.test.TestingCluster) RetryOneTime(org.apache.curator.retry.RetryOneTime)

Example 23 with RetryOneTime

use of org.apache.curator.retry.RetryOneTime in project curator by Netflix.

the class ZkTestSystem method createZkConnection.

public static IZkConnection createZkConnection(String connectString) {
    Timing timing = new Timing();
    CuratorFramework client = CuratorFrameworkFactory.newClient(connectString, timing.session(), timing.connection(), new RetryOneTime(1));
    client.start();
    try {
        return new CuratorZKClientBridge(client);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : CuratorFramework(org.apache.curator.framework.CuratorFramework) RetryOneTime(org.apache.curator.retry.RetryOneTime) CuratorZKClientBridge(com.netflix.curator.x.zkclientbridge.CuratorZKClientBridge) Timing(org.apache.curator.test.Timing) IOException(java.io.IOException)

Example 24 with RetryOneTime

use of org.apache.curator.retry.RetryOneTime in project exhibitor by soabase.

the class TestZookeeperConfigProvider method setup.

@BeforeMethod
public void setup() throws Exception {
    timing = new Timing();
    cluster = new TestingCluster(3);
    cluster.start();
    client = CuratorFrameworkFactory.newClient(cluster.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
    client.start();
}
Also used : TestingCluster(org.apache.curator.test.TestingCluster) RetryOneTime(org.apache.curator.retry.RetryOneTime) Timing(org.apache.curator.test.Timing) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 25 with RetryOneTime

use of org.apache.curator.retry.RetryOneTime in project chassis by Kixeye.

the class ConfigurationBuilderTest method initializeZookeeper.

private static void initializeZookeeper() throws Exception {
    zookeeperServer = new TestingServer();
    curatorFramework = CuratorFrameworkFactory.newClient(zookeeperServer.getConnectString(), new RetryOneTime(1000));
    curatorFramework.start();
}
Also used : TestingServer(org.apache.curator.test.TestingServer) RetryOneTime(org.apache.curator.retry.RetryOneTime)

Aggregations

RetryOneTime (org.apache.curator.retry.RetryOneTime)25 CuratorFramework (org.apache.curator.framework.CuratorFramework)16 Test (org.junit.Test)10 Timing (org.apache.curator.test.Timing)8 TestingServer (org.apache.curator.test.TestingServer)6 Stat (org.apache.zookeeper.data.Stat)4 HashMap (java.util.HashMap)3 Before (org.junit.Before)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Map (java.util.Map)2 CuratorFrameworkFactory (org.apache.curator.framework.CuratorFrameworkFactory)2 TestingCluster (org.apache.curator.test.TestingCluster)2 ElectionCandidate (com.dangdang.ddframe.job.reg.base.ElectionCandidate)1 ConcurrentCompositeConfiguration (com.netflix.config.ConcurrentCompositeConfiguration)1 CuratorZKClientBridge (com.netflix.curator.x.zkclientbridge.CuratorZKClientBridge)1 PotentiallyGzippedCompressionProvider (io.druid.curator.PotentiallyGzippedCompressionProvider)1 Random (java.util.Random)1 NodeState (org.apache.camel.component.zookeepermaster.group.NodeState)1