Package com.netflix.curator.retry

Examples of com.netflix.curator.retry.RetryNTimes


          .newClient(
              zkStr,
              Utils.getInt(conf
                  .get(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT)),
              15000,
              new RetryNTimes(
                  Utils.getInt(conf
                      .get(Config.STORM_ZOOKEEPER_RETRY_TIMES)),
                  Utils.getInt(conf
                      .get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL))));
      return ret;
View Full Code Here


    @Get("/curator")
    public String testCurator() throws Exception {
        String path = "/test_path";
        CuratorFramework client = CuratorFrameworkFactory.builder().connectString("zookeeper.n.miliao.com:2181").namespace("/test1")
                .retryPolicy(new RetryNTimes(Integer.MAX_VALUE, 1000)).connectionTimeoutMs(5000).build();
        // create a node
        client.create().forPath("/head", new byte[0]);

        // delete a node in background
        client.delete().inBackground().forPath("/head");
View Full Code Here

        return "@adf";
    }

    public static void main(String[] args) throws Exception {
        String path = "/test_path";
        CuratorFramework client = CuratorFrameworkFactory.builder().connectString("zookeeper.n.miliao.com:2181").namespace("/brokers").retryPolicy(new RetryNTimes(Integer.MAX_VALUE, 1000)).connectionTimeoutMs(5000).build();
        // 启动 上面的namespace会作为一个最根的节点在使用时自动创建
        client.start();

        // 创建一个节点
        client.create().forPath("/head", new byte[0]);
View Full Code Here

            serverPorts = serverPorts + server + ":" + port + ",";
        }
        return CuratorFrameworkFactory.newClient(serverPorts,
                Utils.getInt(stateConf.get(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT)),
                15000,
                new RetryNTimes(Utils.getInt(stateConf.get(Config.STORM_ZOOKEEPER_RETRY_TIMES)),
                        Utils.getInt(stateConf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL))));
    }
View Full Code Here

        _topic = topic;
        _curator = CuratorFrameworkFactory.newClient(
                zkStr,
                Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT)),
                15000,
                new RetryNTimes(Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_TIMES)),
                        Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL))));
        _curator.start();
    }
View Full Code Here

 
  public ZKClusterCoordinator(DrillConfig config, String connect) throws IOException {
    connect = connect == null || connect.isEmpty() ? config.getString(ExecConstants.ZK_CONNECTION) : connect;
    this.basePath = config.getString(ExecConstants.ZK_ROOT);
    this.serviceName = config.getString(ExecConstants.SERVICE_NAME);
    RetryPolicy rp = new RetryNTimes(config.getInt(ExecConstants.ZK_RETRY_TIMES),
      config.getInt(ExecConstants.ZK_RETRY_DELAY));
    curator = CuratorFrameworkFactory.builder()
      .connectionTimeoutMs(config.getInt(ExecConstants.ZK_TIMEOUT))
      .retryPolicy(rp)
      .connectString(connect)
View Full Code Here

            serverPorts = serverPorts + server + ":" + port + ",";
        }
  return CuratorFrameworkFactory.newClient(serverPorts,
    Utils.getInt(stateConf.get(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT)),
    15000,
    new RetryNTimes(Utils.getInt(stateConf.get(Config.STORM_ZOOKEEPER_RETRY_TIMES)),
        Utils.getInt(stateConf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL))));
    }
View Full Code Here

            _topic = topic;
            _curator = CuratorFrameworkFactory.newClient(
                    zkStr,
                    Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT)),
                    15000,
                    new RetryNTimes(Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_TIMES)),
                    Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL))));
            _curator.start();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

    }

    public void init() throws Exception {

        this.client = CuratorFrameworkFactory.builder().namespace(namespace).connectString(connectString)
                .retryPolicy(new RetryNTimes(this.zkRetries, this.zkRetryInterval)).build();
        this.client.start();
        super.initWatcher();
    }
View Full Code Here

        String connectString = zkHosts(conf);
        int retryCount = Utils.getInt(conf.get("storm.zookeeper.retry.times"));
        int retryInterval = Utils.getInt(conf.get("storm.zookeeper.retry.interval"));

        this.client = CuratorFrameworkFactory.builder().namespace(namespace).connectString(connectString)
                .retryPolicy(new RetryNTimes(retryCount, retryInterval)).build();
        this.client.start();

        super.initWatcher();
    }
View Full Code Here

TOP

Related Classes of com.netflix.curator.retry.RetryNTimes

Copyright © 2018 www.massapicom. 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.