Package org.apache.zookeeper

Examples of org.apache.zookeeper.ZooKeeper$ZKWatchManager


   
    this.clearUpFiles(TestConf.tmpPath);
  }
 
  public ZooKeeper initZK() throws Exception{
    ZooKeeper zk = new ZooKeeper(TestConf.host, Constants.SESSION_TIMEOUT, null);
    List<ACL> acls = new ArrayList<ACL>();
    acls.add(new ACL(Perms.ALL, Ids.ANYONE_ID_UNSAFE));
    zk.create("/iserviceTest", "root".getBytes(), acls, CreateMode.PERSISTENT);
    zk.create("/iserviceTest/node1", "node1".getBytes(), acls, CreateMode.PERSISTENT);
    zk.create("/iserviceTest/node2", "node2".getBytes(), acls, CreateMode.PERSISTENT);
    zk.create("/iserviceTest/node1/node3", "node3".getBytes(), acls, CreateMode.PERSISTENT);
    zk.create("/iserviceTest/node1/node4", "node4".getBytes(), acls, CreateMode.PERSISTENT);
    return zk;
  }
View Full Code Here


  private ZooKeeper zk;
  private int count;
 
  public ChangeZkTask2(String host, String root) throws IOException{
    this.zk = new ZooKeeper(host + root, Constants.SESSION_TIMEOUT, null);
    this.count = 0;
  }
View Full Code Here

   
  }
 
 
  public void initZk() throws Exception{
    ZooKeeper zk = new ZooKeeper(DemoConf.host + DemoConf.root, Constants.SESSION_TIMEOUT, null);
    List<ACL> acls = new ArrayList<ACL>();
    acls.add(new ACL(Perms.ALL, Ids.ANYONE_ID_UNSAFE));
   
    if(zk.exists("/IserviceDemoTest", false) == null){
      zk.create("/IserviceDemoTest", "".getBytes(), acls, CreateMode.PERSISTENT);
      zk.create("/IserviceDemoTest/group1", "".getBytes(), acls, CreateMode.PERSISTENT);
      zk.create("/IserviceDemoTest/group2", "".getBytes(), acls, CreateMode.PERSISTENT);
      zk.create("/IserviceDemoTest/group1/app1", "".getBytes(), acls, CreateMode.PERSISTENT);
      zk.create("/IserviceDemoTest/group1/app2", "".getBytes(), acls, CreateMode.PERSISTENT);
      zk.create("/IserviceDemoTest/group1/app2/key1", "in group1/app2, i'm key1 version-1".getBytes(), acls, CreateMode.PERSISTENT);
      zk.create("/IserviceDemoTest/group1/app2/key2", "".getBytes(), acls, CreateMode.PERSISTENT);
   

  }
View Full Code Here

  private ZooKeeper zk;
  private int count;
 
  public ChangeZkTask(String host, String root) throws IOException{
    this.zk = new ZooKeeper(host + root, Constants.SESSION_TIMEOUT, null);
    this.count = 0;
  }
View Full Code Here

    timer.schedule(task, 0, 10000);
   
  }
 
  public void initZk() throws Exception{
    ZooKeeper zk = new ZooKeeper(DemoConf.host + DemoConf.root, Constants.SESSION_TIMEOUT, null);
    List<ACL> acls = new ArrayList<ACL>();
    acls.add(new ACL(Perms.ALL, Ids.ANYONE_ID_UNSAFE));
   
    if(zk.exists("/IserviceDemoTest", false) == null){
      zk.create("/IserviceDemoTest", "".getBytes(), acls, CreateMode.PERSISTENT);
      zk.create("/IserviceDemoTest/group1", "".getBytes(), acls, CreateMode.PERSISTENT);
      zk.create("/IserviceDemoTest/group2", "".getBytes(), acls, CreateMode.PERSISTENT);
      zk.create("/IserviceDemoTest/group1/app1", "".getBytes(), acls, CreateMode.PERSISTENT);
      zk.create("/IserviceDemoTest/group1/app2", "".getBytes(), acls, CreateMode.PERSISTENT);
      zk.create("/IserviceDemoTest/group1/app2/key1", "in group1/app2, i'm key1 version-1".getBytes(), acls, CreateMode.PERSISTENT);
      zk.create("/IserviceDemoTest/group1/app2/key2", "".getBytes(), acls, CreateMode.PERSISTENT);
   

  }
View Full Code Here

    if (StringUtils.isNotEmpty(config.getZkServer()))
    {
      try
      {
        AnalyzerZKWatcher<SlaveConfig> analyzerZKWatcher = new AnalyzerZKWatcher<SlaveConfig>(config);
        zk = new ZooKeeper(config.getZkServer(),3000,analyzerZKWatcher);
        analyzerZKWatcher.setZk(zk);
       
        //每次启动时都先检查是否有根目录
        ZKUtil.createGroupNodesIfNotExist(zk,config.getGroupId());
       
View Full Code Here

    {
      try
      {
        AnalyzerZKWatcher<MasterConfig> analyzerZKWatcher =
            new AnalyzerZKWatcher<MasterConfig>(config);
        zk = new ZooKeeper(config.getZkServer(),3000,analyzerZKWatcher);
        analyzerZKWatcher.setZk(zk);
       
        //每次启动时都先检查是否有根目录
        ZKUtil.createGroupNodesIfNotExist(zk,config.getGroupId());
       
View Full Code Here

    {
      try
      {
        AnalyzerZKWatcher<MasterConfig> analyzerZKWatcher =
            new AnalyzerZKWatcher<MasterConfig>(config);
        zk = new ZooKeeper(config.getZkServer(),3000,analyzerZKWatcher);
        analyzerZKWatcher.setZk(zk);
       
        ZKUtil.createGroupNodesIfNotExist(zk,config.getGroupId());
      }
      catch(Exception ex)
View Full Code Here

    BlurQueryChecker queryChecker = new BlurQueryChecker(configuration);

    int sessionTimeout = configuration.getInt(BLUR_ZOOKEEPER_TIMEOUT, BLUR_ZOOKEEPER_TIMEOUT_DEFAULT);

    final ZooKeeper zooKeeper = ZkUtils.newZooKeeper(zkConnectionStr, sessionTimeout);

    BlurUtil.setupZookeeper(zooKeeper, configuration.get(BLUR_CLUSTER_NAME));

    final ZookeeperClusterStatus clusterStatus = new ZookeeperClusterStatus(zooKeeper, configuration);
View Full Code Here

      throw new RuntimeException(e);
    }
  }

  public ZookeeperClusterStatus(String connectionStr, BlurConfiguration configuration) throws IOException {
    this(new ZooKeeper(connectionStr, 30000, new Watcher() {
      @Override
      public void process(WatchedEvent event) {

      }
    }), configuration);
View Full Code Here

TOP

Related Classes of org.apache.zookeeper.ZooKeeper$ZKWatchManager

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.