gpt4 book ai didi

org.apache.accumulo.core.client.ZooKeeperInstance.getInstanceID()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 00:42:40 26 4
gpt4 key购买 nike

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

ZooKeeperInstance.getInstanceID介绍

暂无

代码示例

代码示例来源:origin: apache/accumulo

@Override
public String getInstanceName() {
 if (instanceName == null)
  instanceName = InstanceOperationsImpl.lookupInstanceName(zooCache,
    UUID.fromString(getInstanceID()));
 return instanceName;
}

代码示例来源:origin: apache/accumulo

@Override
public List<String> getMasterLocations() {
 String masterLocPath = ZooUtil.getRoot(getInstanceID()) + Constants.ZMASTER_LOCK;
 OpTimer timer = null;
 if (log.isTraceEnabled()) {
  log.trace("tid={} Looking up master location in zookeeper.", Thread.currentThread().getId());
  timer = new OpTimer().start();
 }
 byte[] loc = ZooUtil.getLockData(zooCache, masterLocPath);
 if (timer != null) {
  timer.stop();
  log.trace("tid={} Found master at {} in {}", Thread.currentThread().getId(),
    (loc == null ? "null" : new String(loc, UTF_8)),
    String.format("%.3f secs", timer.scale(TimeUnit.SECONDS)));
 }
 if (loc == null) {
  return Collections.emptyList();
 }
 return Collections.singletonList(new String(loc, UTF_8));
}

代码示例来源:origin: apache/accumulo

@Override
public String getRootTabletLocation() {
 String zRootLocPath = ZooUtil.getRoot(getInstanceID()) + RootTable.ZROOT_TABLET_LOCATION;
 OpTimer timer = null;
 if (log.isTraceEnabled()) {
  log.trace("tid={} Looking up root tablet location in zookeeper.",
    Thread.currentThread().getId());
  timer = new OpTimer().start();
 }
 byte[] loc = zooCache.get(zRootLocPath);
 if (timer != null) {
  timer.stop();
  log.trace("tid={} Found root tablet at {} in {}", Thread.currentThread().getId(),
    (loc == null ? "null" : new String(loc, UTF_8)),
    String.format("%.3f secs", timer.scale(TimeUnit.SECONDS)));
 }
 if (loc == null) {
  return null;
 }
 return new String(loc, UTF_8).split("\\|")[0];
}

代码示例来源:origin: apache/accumulo

ZooKeeperInstance(ClientConfiguration config, ZooCacheFactory zcf) {
 checkArgument(config != null, "config is null");
 // Enable singletons before before getting a zoocache
 SingletonManager.setMode(Mode.CONNECTOR);
 this.clientConf = config;
 this.instanceId = clientConf.get(ClientConfiguration.ClientProperty.INSTANCE_ID);
 this.instanceName = clientConf.get(ClientConfiguration.ClientProperty.INSTANCE_NAME);
 if ((instanceId == null) == (instanceName == null))
  throw new IllegalArgumentException(
    "Expected exactly one of instanceName and instanceId to be set; "
      + (instanceName == null ? "neither" : "both") + " were set");
 this.zooKeepers = clientConf.get(ClientConfiguration.ClientProperty.INSTANCE_ZK_HOST);
 this.zooKeepersSessionTimeOut = (int) ConfigurationTypeHelper
   .getTimeInMillis(clientConf.get(ClientConfiguration.ClientProperty.INSTANCE_ZK_TIMEOUT));
 zooCache = zcf.getZooCache(zooKeepers, zooKeepersSessionTimeOut);
 if (instanceName != null) {
  // Validates that the provided instanceName actually exists
  getInstanceID();
 }
}

代码示例来源:origin: org.apache.accumulo/accumulo-core

@Override
public String getInstanceName() {
 if (instanceName == null)
  instanceName = InstanceOperationsImpl.lookupInstanceName(zooCache,
    UUID.fromString(getInstanceID()));
 return instanceName;
}

代码示例来源:origin: Accla/graphulo

public  TCredentials getCredentials() throws D4mException {
    TCredentials tCred;
    try {
      // DH2015: Copied from
      // 1.6: org.apache.accumulo.core.security.Credentials#toThrift()
      // 1.7: org.apache.accumulo.core.client.impl.Credentials#toThrift()
      // in order to create compatibility to 1.6 and 1.7, since the Credentials class moved.
      // This may still break in later versions because Credentials is non-public API.
      tCred = new TCredentials(principal, token.getClass().getName(),
          ByteBuffer.wrap(AuthenticationToken.AuthenticationTokenSerializer.serialize(token)), instance.getInstanceID());
      if (token.isDestroyed())
        throw new RuntimeException("Token has been destroyed", new AccumuloSecurityException(principal, SecurityErrorCode.TOKEN_EXPIRED));

//            tCred =  this.creds.toThrift(this.instance);  //.create(this.conn.getUser(), this.passwordToken, this.instance.getInstanceID() );
    } catch (Exception e) {
      log.warn("",e);
      throw new D4mException(e);
    }
    return tCred;
  }

代码示例来源:origin: org.apache.accumulo/accumulo-test

String uuid = new ZooKeeperInstance(cluster.getClientConfig()).getInstanceID();

代码示例来源:origin: org.apache.accumulo/accumulo-test

String uuid = new ZooKeeperInstance(cluster.getClientConfig()).getInstanceID();

代码示例来源:origin: org.apache.accumulo/accumulo-core

ZooKeeperInstance(Configuration config, ZooCacheFactory zcf) {
 checkArgument(config != null, "config is null");
 if (config instanceof ClientConfiguration) {
  this.clientConf = (ClientConfiguration) config;
 } else {
  @SuppressWarnings("deprecation")
  ClientConfiguration cliConf = new ClientConfiguration(config);
  this.clientConf = cliConf;
 }
 this.instanceId = clientConf.get(ClientProperty.INSTANCE_ID);
 this.instanceName = clientConf.get(ClientProperty.INSTANCE_NAME);
 if ((instanceId == null) == (instanceName == null))
  throw new IllegalArgumentException(
    "Expected exactly one of instanceName and instanceId to be set");
 this.zooKeepers = clientConf.get(ClientProperty.INSTANCE_ZK_HOST);
 this.zooKeepersSessionTimeOut = (int) AccumuloConfiguration
   .getTimeInMillis(clientConf.get(ClientProperty.INSTANCE_ZK_TIMEOUT));
 zooCache = zcf.getZooCache(zooKeepers, zooKeepersSessionTimeOut);
 if (null != instanceName) {
  // Validates that the provided instanceName actually exists
  getInstanceID();
 }
}

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