Package com.netflix.curator.framework

Examples of com.netflix.curator.framework.CuratorFramework.start()


                "Unrecoverable Zookeeper error");

          }
        });

    fk.start();

    return fk;
  }

  public String createNode(CuratorFramework zk, String path, byte[] data,
View Full Code Here


  }

  public static CuratorFramework newCuratorStarted(Map conf,
      List<String> servers, Object port, String root) {
    CuratorFramework ret = newCurator(conf, servers, port, root);
    ret.start();
    return ret;
  }

  public static CuratorFramework newCuratorStarted(Map conf,
      List<String> servers, Object port) {
View Full Code Here

  }

  public static CuratorFramework newCuratorStarted(Map conf,
      List<String> servers, Object port) {
    CuratorFramework ret = newCurator(conf, servers, port);
    ret.start();
    return ret;
  }

  /**
   *
 
View Full Code Here

    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

        return newCurator(conf, servers, port, "");
    }

    public static CuratorFramework newCuratorStarted(Map conf, List<String> servers, Object port, String root) {
        CuratorFramework ret = newCurator(conf, servers, port, root);
        ret.start();
        return ret;
    }

    public static CuratorFramework newCuratorStarted(Map conf, List<String> servers, Object port) {
        CuratorFramework ret = newCurator(conf, servers, port);
View Full Code Here

        return ret;
    }

    public static CuratorFramework newCuratorStarted(Map conf, List<String> servers, Object port) {
        CuratorFramework ret = newCurator(conf, servers, port);
        ret.start();
        return ret;
    }   
   
    /**
     *
 
View Full Code Here

        // Load the config.yaml file specified as the first argument (optional).
        CalculatorConfiguration config = loadConfigFile(parsedArgs.getString("config-file"));

        // Connect to ZooKeeper
        CuratorFramework curator = config.getZooKeeperConfiguration().newCurator();
        curator.start();

        // Connection caching is optional, but included here for the sake of demonstration.
        ServiceCachingPolicy cachingPolicy = new ServiceCachingPolicyBuilder()
                .withMaxNumServiceInstances(10)
                .withMaxNumServiceInstancesPerEndPoint(1)
View Full Code Here

        // Load the config.yaml file specified as the first argument (optional).
        CalculatorConfiguration config = loadConfigFile(parsedArgs.getString("config-file"));

        // Connect to ZooKeeper
        CuratorFramework curator = config.getZooKeeperConfiguration().newCurator();
        curator.start();

        // Connection caching is optional, but included here for the sake of demonstration.
        ServiceCachingPolicy cachingPolicy = new ServiceCachingPolicyBuilder()
                .withMaxNumServiceInstances(10)
                .withMaxNumServiceInstancesPerEndPoint(1)
View Full Code Here

        Closeables.closeQuietly(curator);
    }

    private static CuratorFramework newCurator(ZooKeeperConfiguration config) {
        CuratorFramework curator = CuratorFrameworkFactory.newClient(config.getConnectString(), config.getRetry());
        curator.start();

        return curator.usingNamespace(config.getNamespace());
    }
}
View Full Code Here

        Closeables.closeQuietly(curator);
    }

    private static CuratorFramework newCurator(ZooKeeperConfiguration config) {
        CuratorFramework curator = CuratorFrameworkFactory.newClient(config.getConnectString(), config.getRetry());
        curator.start();

        return curator.usingNamespace(config.getNamespace());
    }
}
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.