Examples of ExponentialBackoffRetry


Examples of org.apache.curator.retry.ExponentialBackoffRetry

    {
        CuratorFramework client1 = null;
        CuratorFramework client2 = null;
        try
        {
            client1 = CuratorFrameworkFactory.newClient(server.getConnectString(), new ExponentialBackoffRetry(100, 3));
            client2 = CuratorFrameworkFactory.newClient(server.getConnectString(), new ExponentialBackoffRetry(100, 3));
            client1.start();
            client2.start();

            final InterProcessLock mutexForClient1 = makeLock(client1);
            final InterProcessLock mutexForClient2 = makeLock(client2);
View Full Code Here

Examples of org.apache.curator.retry.ExponentialBackoffRetry

            public void sleepFor(long time, TimeUnit unit) throws InterruptedException
            {
                Assert.assertTrue(unit.toMillis(time) <= 100);
            }
        };
        ExponentialBackoffRetry         retry = new ExponentialBackoffRetry(1, Integer.MAX_VALUE, 100);
        for ( int i = 0; i >= 0; ++i )
        {
            retry.allowRetry(i, 0, sleeper);
        }
    }
View Full Code Here

Examples of org.apache.curator.retry.ExponentialBackoffRetry

        TestingServer       server = new TestingServer();
        CuratorFramework    client = null;
        PathChildrenCache   cache = null;
        try
        {
            client = CuratorFrameworkFactory.newClient(server.getConnectString(), new ExponentialBackoffRetry(1000, 3));
            client.start();

            // in this example we will cache data. Notice that this is optional.
            cache = new PathChildrenCache(client, PATH, true);
            cache.start();
View Full Code Here

Examples of org.apache.curator.retry.ExponentialBackoffRetry

        CuratorFramework                                client = null;
        ServiceDiscovery<InstanceDetails>               serviceDiscovery = null;
        Map<String, ServiceProvider<InstanceDetails>>   providers = Maps.newHashMap();
        try
        {
            client = CuratorFrameworkFactory.newClient(server.getConnectString(), new ExponentialBackoffRetry(1000, 3));
            client.start();

            JsonInstanceSerializer<InstanceDetails> serializer = new JsonInstanceSerializer<InstanceDetails>(InstanceDetails.class);
            serviceDiscovery = ServiceDiscoveryBuilder.builder(InstanceDetails.class).client(client).basePath(PATH).serializer(serializer).build();
            serviceDiscovery.start();
View Full Code Here

Examples of org.apache.curator.retry.ExponentialBackoffRetry

        String connectionString = server.getConnectString();
        Map conf = new HashMap();
        conf.put(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT, 1000);
        conf.put(Config.STORM_ZOOKEEPER_RETRY_TIMES, 4);
        conf.put(Config.STORM_ZOOKEEPER_RETRY_INTERVAL, 5);
        ExponentialBackoffRetry retryPolicy = new ExponentialBackoffRetry(1000, 3);
        zookeeper = CuratorFrameworkFactory.newClient(connectionString, retryPolicy);
        dynamicBrokersReader = new DynamicBrokersReader(conf, connectionString, masterPath, topic);
        zookeeper.start();
    }
View Full Code Here

Examples of org.apache.curator.retry.ExponentialBackoffRetry

   * Create a retry policy for this configuration
   * @param conf
   * @return
   */
  public RetryPolicy createRetryPolicy() {
    RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
    return retryPolicy;
  }
View Full Code Here

Examples of org.apache.curator.retry.ExponentialBackoffRetry

        TestingServer       server = new TestingServer();
        CuratorFramework    client = null;
        PathChildrenCache   cache = null;
        try
        {
            client = CuratorFrameworkFactory.newClient(server.getConnectString(), new ExponentialBackoffRetry(1000, 3));
            client.start();

            // in this example we will cache data. Notice that this is optional.
            cache = new PathChildrenCache(client, PATH, true);
            cache.start();
View Full Code Here

Examples of org.apache.curator.retry.ExponentialBackoffRetry

        TestingServer           server = new TestingServer();
        try
        {
            for ( int i = 0; i < CLIENT_QTY; ++i )
            {
                CuratorFramework    client = CuratorFrameworkFactory.newClient(server.getConnectString(), new ExponentialBackoffRetry(1000, 3));
                clients.add(client);

                ExampleClient       example = new ExampleClient(client, PATH, "Client #" + i);
                examples.add(example);
View Full Code Here

Examples of org.apache.curator.retry.ExponentialBackoffRetry

{
    @Test
    public void     testLostSession() throws Exception
    {
        Timing                  timing = new Timing();
        CuratorFramework        client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new ExponentialBackoffRetry(100, 3));
        try
        {
            client.start();

            client.create().forPath("/test-me");
View Full Code Here

Examples of org.apache.curator.retry.ExponentialBackoffRetry

    {
        Timing                  timing = new Timing();
        CuratorFramework        client = CuratorFrameworkFactory.builder().connectString(server.getConnectString())
            .sessionTimeoutMs(timing.session())
            .connectionTimeoutMs(timing.connection())
            .retryPolicy(new ExponentialBackoffRetry(100, 3))
            .namespace("aisa")
            .build();
        try
        {
            client.start();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.