gpt4 book ai didi

com.ngdata.sep.util.zookeeper.ZooKeeperItf.getData()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 17:57:31 26 4
gpt4 key购买 nike

本文整理了Java中com.ngdata.sep.util.zookeeper.ZooKeeperItf.getData()方法的一些代码示例,展示了ZooKeeperItf.getData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperItf.getData()方法的具体详情如下:
包路径:com.ngdata.sep.util.zookeeper.ZooKeeperItf
类名称:ZooKeeperItf
方法名:getData

ZooKeeperItf.getData介绍

暂无

代码示例

代码示例来源:origin: NGDATA/hbase-indexer

@Override
  public byte[] execute() throws KeeperException, InterruptedException {
    return zk.getData(childPath, false, stat);
  }
});

代码示例来源:origin: com.ngdata/hbase-indexer-model

@Override
  public byte[] execute() throws KeeperException, InterruptedException {
    return zk.getData(childPath, false, stat);
  }
});

代码示例来源:origin: NGDATA/hbase-indexer

@Override
  public Boolean execute() throws KeeperException, InterruptedException {
    data.add(zk.getData(path, watcher, stat));
    return null;
  }
});

代码示例来源:origin: com.ngdata/hbase-sep-impl-common

@Override
  public Boolean execute() throws KeeperException, InterruptedException {
    data.add(zk.getData(path, watcher, stat));
    return null;
  }
});

代码示例来源:origin: NGDATA/hbase-indexer

@Override
  public Boolean execute() throws KeeperException, InterruptedException {
    byte[] currentData = zk.getData(path, false, new Stat());
    if (!Arrays.equals(currentData, data)) {
      zk.setData(path, data, -1);
    }
    return null;
  }
});

代码示例来源:origin: com.ngdata/hbase-sep-impl-common

@Override
  public Boolean execute() throws KeeperException, InterruptedException {
    byte[] currentData = zk.getData(path, false, new Stat());
    if (!Arrays.equals(currentData, data)) {
      zk.setData(path, data, -1);
    }
    return null;
  }
});

代码示例来源:origin: NGDATA/hbase-indexer

@Override
    public List<IndexerProcess> execute() throws KeeperException, InterruptedException {
      List<IndexerProcess> indexerProcesses = Lists.newArrayList();
      for (String childNode : zk.getChildren(zkBaseNode, false)) {
        List<String> nodeNameParts = Lists.newArrayList(Splitter.on(',').split(childNode));
        if (indexerName.equals(nodeNameParts.get(0))) {
          byte[] errorBytes = zk.getData(zkBaseNode + "/" + childNode, false, null);
          IndexerProcess indexerProcess = new IndexerProcess(indexerName,
              nodeNameParts.get(1),
              errorBytes == null  || errorBytes.length == 0? null : Bytes.toString(errorBytes));
          indexerProcesses.add(indexerProcess);
        }
      }
      return indexerProcesses;
      
    }});
} catch (Exception e) {

代码示例来源:origin: com.ngdata/hbase-indexer-model

@Override
    public List<IndexerProcess> execute() throws KeeperException, InterruptedException {
      List<IndexerProcess> indexerProcesses = Lists.newArrayList();
      for (String childNode : zk.getChildren(zkBaseNode, false)) {
        List<String> nodeNameParts = Lists.newArrayList(Splitter.on(',').split(childNode));
        if (indexerName.equals(nodeNameParts.get(0))) {
          byte[] errorBytes = zk.getData(zkBaseNode + "/" + childNode, false, null);
          IndexerProcess indexerProcess = new IndexerProcess(indexerName,
              nodeNameParts.get(1),
              errorBytes == null  || errorBytes.length == 0? null : Bytes.toString(errorBytes));
          indexerProcesses.add(indexerProcess);
        }
      }
      return indexerProcesses;
      
    }});
} catch (Exception e) {

代码示例来源:origin: NGDATA/hbase-indexer

private Configuration getHBaseConf(ZooKeeperItf zk, int hbaseMasterPort) throws KeeperException, InterruptedException, IOException {
  // Read the HBase/Hadoop configuration via the master web ui
  // This is debatable, but it avoids any pitfalls with conf dirs and also works with launch-test-lily
  byte[] masterServerName = removeMetaData(zk.getData("/hbase/master", false, new Stat()));
  String hbaseMasterHostName = getServerName(masterServerName).getHostname();        
  String url = String.format("http://%s:%d/conf", hbaseMasterHostName, hbaseMasterPort);
  System.out.println("Reading HBase configuration from " + url);
  byte[] data = readUrl(url);
  Configuration conf = new Configuration();
  conf.addResource(new ByteArrayInputStream(data));
  return conf;
}

代码示例来源:origin: NGDATA/hbase-indexer

@Override
  public Object execute() throws KeeperException, InterruptedException {
    byte[] data = zk.getData(indexerPath, false, null);
    String trashPath = indexerTrashPath + "/" + indexerName;
    // An indexer with the same name might have existed before and hence already exist
    // in the indexer trash, handle this by appending a sequence number until a unique
    // name is found.
    String baseTrashpath = trashPath;
    int count = 0;
    while (zk.exists(trashPath, false) != null) {
      count++;
      trashPath = baseTrashpath + "." + count;
    }
    zk.create(trashPath, data, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
    return null;
  }
});

代码示例来源:origin: com.ngdata/hbase-sep-tools

private Configuration getHBaseConf(ZooKeeperItf zk, int hbaseMasterPort) throws KeeperException, InterruptedException, IOException {
  // Read the HBase/Hadoop configuration via the master web ui
  // This is debatable, but it avoids any pitfalls with conf dirs and also works with launch-test-lily
  byte[] masterServerName = removeMetaData(zk.getData(zookeeperZNodeParent + "/master", false, new Stat()));
  String hbaseMasterHostName = getServerName(masterServerName).getHostname();
  String ulrScheme = (useSSL) ? "https" : "http" ;
  String url = String.format("%s://%s:%d/conf", ulrScheme, hbaseMasterHostName, hbaseMasterPort);
  System.out.println("Reading HBase configuration from " + url);
  byte[] data = null;
  try {
   data = readUrl(url);
  } catch (ClientProtocolException ex) {
   if(!useSSL) {
    System.out.println("Hint : Please check if HBASE is configured with SSL. If yes then use --use-ssl option");
   }
   throw ex;
  }
  Configuration conf = new Configuration();
  conf.addResource(new ByteArrayInputStream(data));
  return conf;
}

代码示例来源:origin: com.ngdata/hbase-indexer-model

@Override
  public Object execute() throws KeeperException, InterruptedException {
    byte[] data = zk.getData(indexerPath, false, null);
    String trashPath = indexerTrashPath + "/" + indexerName;
    // An indexer with the same name might have existed before and hence already exist
    // in the indexer trash, handle this by appending a sequence number until a unique
    // name is found.
    String baseTrashpath = trashPath;
    int count = 0;
    while (zk.exists(trashPath, false) != null) {
      count++;
      trashPath = baseTrashpath + "." + count;
    }
    zk.create(trashPath, data, CreateMode.PERSISTENT);
    return null;
  }
});

代码示例来源:origin: NGDATA/hbase-indexer

byte[] data = zk.getData(hlogsPath + "/" + log, false, stat);

代码示例来源:origin: com.ngdata/hbase-sep-tools

byte[] data = zk.getData(hlogsPath + "/" + log, false, stat);

代码示例来源:origin: NGDATA/hbase-indexer

private IndexerDefinition loadIndexer(String indexerName, boolean forCache)
    throws InterruptedException, KeeperException, IndexerNotFoundException {
  final String childPath = indexerCollectionPath + "/" + indexerName;
  final Stat stat = new Stat();
  byte[] data;
  try {
    if (forCache) {
      // do not retry, install watcher
      data = zk.getData(childPath, watcher, stat);
    } else {
      // do retry, do not install watcher
      data = zk.retryOperation(new ZooKeeperOperation<byte[]>() {
        @Override
        public byte[] execute() throws KeeperException, InterruptedException {
          return zk.getData(childPath, false, stat);
        }
      });
    }
  } catch (KeeperException.NoNodeException e) {
    throw new IndexerNotFoundException(indexerName);
  }
  IndexerDefinitionBuilder builder = IndexerDefinitionJsonSerDeser.INSTANCE.fromJsonBytes(data);
  builder.name(indexerName);
  builder.occVersion(stat.getVersion());
  return builder.build();
}

代码示例来源:origin: com.ngdata/hbase-indexer-model

private IndexerDefinition loadIndexer(String indexerName, boolean forCache)
    throws InterruptedException, KeeperException, IndexerNotFoundException {
  final String childPath = indexerCollectionPath + "/" + indexerName;
  final Stat stat = new Stat();
  byte[] data;
  try {
    if (forCache) {
      // do not retry, install watcher
      data = zk.getData(childPath, watcher, stat);
    } else {
      // do retry, do not install watcher
      data = zk.retryOperation(new ZooKeeperOperation<byte[]>() {
        @Override
        public byte[] execute() throws KeeperException, InterruptedException {
          return zk.getData(childPath, false, stat);
        }
      });
    }
  } catch (KeeperException.NoNodeException e) {
    throw new IndexerNotFoundException(indexerName);
  }
  IndexerDefinitionBuilder builder = IndexerDefinitionJsonSerDeser.INSTANCE.fromJsonBytes(data);
  builder.name(indexerName);
  builder.occVersion(stat.getVersion());
  return builder.build();
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com