Examples of Stat


Examples of org.apache.zookeeper.data.Stat

                        @Override
                        public void eventReceived(CuratorFramework client, CuratorEvent event) throws Exception
                        {
                            if ( event.getType() == CuratorEventType.EXISTS )
                            {
                                Stat stat = client.checkExists().forPath("/yo/yo/yo");
                                Assert.assertNull(stat);

                                client.create().inBackground(event.getContext()).forPath("/what");
                            }
                            else if ( event.getType() == CuratorEventType.CREATE )
View Full Code Here

Examples of org.apache.zookeeper.data.Stat

            client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
            client.start();

            readBytes = client.getData().forPath("/test");
            Assert.assertEquals(writtenBytes, readBytes);
            Stat    stat = client.checkExists().forPath("/ghost");
            Assert.assertNull(stat);

            String  realPath = client.create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath("/pseq", writtenBytes);
            Assert.assertNotSame(realPath, "/pseq");
View Full Code Here

Examples of org.apache.zookeeper.data.Stat

    // shutdown HBase cluster
    TEST_UTIL.shutdownMiniHBaseCluster();
    // create a RIT node in offline state
    ZooKeeperWatcher zkw = TEST_UTIL.getZooKeeperWatcher();
    ZKAssign.createNodeOffline(zkw, hri, dstName);
    Stat stat = new Stat();
    byte[] data =
        ZKAssign.getDataNoWatch(zkw, hri.getEncodedName(), stat);
    assertTrue(data != null);
    RegionTransition rt = RegionTransition.parseFrom(data);
    assertTrue(rt.getEventType() == EventType.M_ZK_REGION_OFFLINE);
View Full Code Here

Examples of org.apache.zookeeper.data.Stat

      }

      String url = null;
      try {
        // get new URL
        Stat stat = new Stat();
        byte[] urlAsBytes = zk.getData(ZK_MODEL, this, stat);
        int latestVersion = stat.getVersion();

        url = new String(urlAsBytes, Charsets.UTF_8);

        // check for change
        URL modelUrl = new URL(url);
View Full Code Here

Examples of org.apache.zookeeper.data.Stat

                    /* We need only the last portion of this znode */
                    int index = getLocalSuffix();                  
                    if ( index > suffixToZnode.firstKey() )
                    {
                        String pathToCheck = path + "/" + getImmediatelyPrecedingZnode(suffixToZnode, index);
                        Stat stat = zk.exists(pathToCheck, true);
                        if ( stat != null )
                        {
                            logger_.debug("Awaiting my turn ...");
                            condition_.await();
                            logger_.debug("Checking to see if leader is around ...");
View Full Code Here

Examples of org.apache.zookeeper.data.Stat

    }

    private byte[] getData(final String znode) {
        try {
            final Stat stat = zkCurator.checkExists().usingWatcher(this).forPath(znode);
            if (stat != null) {
                return zkCurator.getData().usingWatcher(this).forPath(znode);
            }
        } catch (final Exception e) {
            LOGGER.warn("Zookeeper exception.", e);
View Full Code Here

Examples of org.apache.zookeeper.data.Stat

  }
 
 
  protected static void createNodeIfNotExist(ZooKeeper zk,String path,byte[] data) throws KeeperException, InterruptedException
  {
    Stat node = zk.exists(path, false);
   
    if (node == null)
    {
      zk.create(path,data, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
    }
View Full Code Here

Examples of org.apache.zookeeper.data.Stat

    }
  }
 
  protected static void updateOrCreateNode(ZooKeeper zk,String path,byte[] data) throws KeeperException, InterruptedException
  {
    Stat node = zk.exists(path, false);
   
    if (node == null)
    {
      zk.create(path,data,Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
    }
View Full Code Here

Examples of org.apache.zookeeper.data.Stat

        org.apache.zookeeper.CreateMode.PERSISTENT);
  }

  public boolean existsNode(CuratorFramework zk, String path, boolean watch)
      throws Exception {
    Stat stat = null;
    if (watch) {
      stat = zk.checkExists().watched()
          .forPath(PathUtils.normalize_path(path));
    } else {
      stat = zk.checkExists().forPath(PathUtils.normalize_path(path));
View Full Code Here

Examples of org.apache.zookeeper.data.Stat

      this.store.inform(Constants.ZK_ERROR);
    }
  }
 
  public void watch(String prefix) {
    Stat s = new Stat();
    String info;
    try {
      info = new String(this.zk.getData(prefix, true, s));
      this.store.check(prefix, info);
    } catch (Exception e) {
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.