gpt4 book ai didi

org.apache.twill.zookeeper.ZKClients.namespace()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 15:28:40 24 4
gpt4 key购买 nike

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

ZKClients.namespace介绍

[英]Creates a ZKClient that will add prefix namespace for every paths.
[中]创建一个ZKClient,为每个路径添加前缀命名空间。

代码示例

代码示例来源:origin: co.cask.cdap/cdap-data-fabric

private ZKClient getCoordinatorZKClient() {
  return ZKClients.namespace(zkClient, Constants.Stream.STREAM_ZK_COORDINATION_NAMESPACE);
 }
}

代码示例来源:origin: co.cask.cdap/cdap-data-fabric

private ZKClient getCoordinatorZKClient() {
 return ZKClients.namespace(zkClient, Constants.Stream.STREAM_ZK_COORDINATION_NAMESPACE);
}

代码示例来源:origin: caskdata/coopr

public SynchronizedZKMap(ZKClient zkClient, String namespace, Serializer<T> serializer) {
 this(namespace == null ? zkClient : ZKClients.namespace(zkClient, namespace), serializer);
}

代码示例来源:origin: org.apache.twill/twill-yarn

/**
 * Returns a {@link ZKClient} that namespaced under the given run id.
 */
private static ZKClient getAppRunZKClient(ZKClient zkClient, RunId appRunId) {
 return ZKClients.namespace(zkClient, String.format("/%s", appRunId));
}

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

/**
 * Returns a {@link ZKClient} that namespaced under the given run id.
 */
private static ZKClient getAppRunZKClient(ZKClient zkClient, RunId appRunId) {
 return ZKClients.namespace(zkClient, String.format("/%s", appRunId));
}

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

private static ZKClient getContainerZKClient(ZKClient zkClient, RunId appRunId, String runnableName) {
 return ZKClients.namespace(zkClient, String.format("/%s/runnables/%s", appRunId, runnableName));
}

代码示例来源:origin: org.apache.twill/twill-yarn

private static ZKClient getContainerZKClient(ZKClient zkClient, RunId appRunId, String runnableName) {
 return ZKClients.namespace(zkClient, String.format("/%s/runnables/%s", appRunId, runnableName));
}

代码示例来源:origin: caskdata/cdap

@Override
 public ZKDiscoveryService load(String key) {
  String ns = String.format("%s/%s", twillNamespace, key);
  LOG.info("Create ZKDiscoveryClient for {}", ns);
  return new ZKDiscoveryService(ZKClients.namespace(zkClient, ns));
 }
};

代码示例来源:origin: caskdata/coopr

public ZKMap(ZKClient zkClient, String namespace, Serializer<T> serializer)
 throws ExecutionException, InterruptedException {
 this.zkClient = namespace == null ? zkClient : ZKClients.namespace(zkClient, namespace);
 this.serializer = serializer;
 this.currentView = new AtomicReference<Map<String, T>>(Collections.<String, T>emptyMap());
 this.waitingForElements = Maps.newHashMap();
 setExternalChangeWatcher();
}

代码示例来源:origin: caskdata/cdap

/**
 * Creates an instance of {@link ZKPropertyStore} with nodes created under the given namespace.
 *
 * @param zkClient client for interacting with ZooKeeper
 * @param namespace Namespace for zk nodes to reside in
 * @param codec The codec for encode/decode property
 */
public static <T> ZKPropertyStore<T> create(ZKClient zkClient, String namespace, Codec<T> codec) {
 return new ZKPropertyStore<>(ZKClients.namespace(zkClient, namespace), codec);
}

代码示例来源:origin: co.cask.cdap/cdap-common

@Override
 public DiscoveryServiceClient load(String key) throws Exception {
  String ns = String.format("%s/%s", twillNamespace, key);
  LOG.debug("Create ZKDiscoveryClient for " + ns);
  return new ZKDiscoveryService(ZKClients.namespace(zkClient, ns));
 }
};

代码示例来源:origin: co.cask.cdap/cdap-common

/**
 * Creates an instance of {@link ZKPropertyStore} with nodes created under the given namespace.
 *
 * @param zkClient client for interacting with ZooKeeper
 * @param namespace Namespace for zk nodes to reside in
 * @param codec The codec for encode/decode property
 */
public static <T> ZKPropertyStore<T> create(ZKClient zkClient, String namespace, Codec<T> codec) {
 return new ZKPropertyStore<>(ZKClients.namespace(zkClient, namespace), codec);
}

代码示例来源:origin: co.cask.tigon/tigon-yarn

@Override
 public DiscoveryServiceClient load(String key) throws Exception {
  int idx = key.indexOf('.');  // It must be found as checked in the discover method
  String ns = String.format("%s/%s%s", twillNamespace, key.substring(0, idx), key.substring(idx));
  LOG.debug("Create ZKDiscoveryClient for " + ns);
  return new ZKDiscoveryService(ZKClients.namespace(zkClient, ns));
 }
};

代码示例来源:origin: caskdata/coopr

public ZKCollection(ZKClient zkClient, String namespace, Serializer<T> serializer)
 throws ExecutionException, InterruptedException {
 this.zkClient = namespace == null ? zkClient : ZKClients.namespace(zkClient, namespace);
 this.serializer = serializer;
 this.currentView = new AtomicReference<Collection<T>>(Collections.<T>emptyList());
 setExternalChangeWatcher();
}

代码示例来源:origin: cdapio/cdap

@Inject
SparkServiceAnnouncer(CConfiguration cConf, ZKClient zKClient, ProgramId programId) {
 // Use the ZK path that points to the Twill application of the Spark client.
 String ns = String.format("%s/%s", cConf.get(Constants.CFG_TWILL_ZK_NAMESPACE),
              ServiceDiscoverable.getName(programId));
 this.zkClient = ZKClients.namespace(zKClient, ns);
}

代码示例来源:origin: co.cask.cdap/cdap-spark-core2

@Inject
SparkServiceAnnouncer(CConfiguration cConf, ZKClient zKClient, ProgramId programId) {
 // Use the ZK path that points to the Twill application of the Spark client.
 String ns = String.format("%s/%s", cConf.get(Constants.CFG_TWILL_ZK_NAMESPACE),
              ServiceDiscoverable.getName(programId));
 this.zkClient = ZKClients.namespace(zKClient, ns);
}

代码示例来源:origin: caskdata/cdap

@Inject
SparkServiceAnnouncer(CConfiguration cConf, ZKClient zKClient, ProgramId programId) {
 // Use the ZK path that points to the Twill application of the Spark client.
 String ns = String.format("%s/%s", cConf.get(Constants.CFG_TWILL_ZK_NAMESPACE),
              ServiceDiscoverable.getName(programId));
 this.zkClient = ZKClients.namespace(zKClient, ns);
}

代码示例来源:origin: co.cask.cdap/cdap-data-fabric

@Override
protected Lock getLock(StreamId streamId) {
 // It's ok to create new locks every time as it's backed by ZK for distributed lock
 ZKClient lockZKClient = ZKClients.namespace(zkClient, "/" + Constants.Service.STREAMS + "/locks");
 return new ReentrantDistributedLock(lockZKClient, streamId.toString());
}

代码示例来源:origin: cdapio/cdap

public DistributedKeyManager(CConfiguration conf, Codec<KeyIdentifier> codec, ZKClient zookeeper, List<ACL> acls) {
 super(conf);
 this.parentZNode = conf.get(Constants.Security.DIST_KEY_PARENT_ZNODE);
 this.keyExpirationPeriod = conf.getLong(Constants.Security.TOKEN_DIGEST_KEY_EXPIRATION);
 this.maxTokenExpiration = Math.max(
  conf.getLong(Constants.Security.EXTENDED_TOKEN_EXPIRATION),
  conf.getLong(Constants.Security.TOKEN_EXPIRATION));
 this.zookeeper = ZKClients.namespace(zookeeper, parentZNode);
 if (acls.isEmpty()) {
  LOG.warn("ZooKeeper ACL list is empty for keys!");
  acls = ZooDefs.Ids.OPEN_ACL_UNSAFE;
 }
 LOG.debug("ZooKeeper ACLs {} for keys", acls);
 this.keyCache = new SharedResourceCache<>(zookeeper, codec, "/keys", acls);
}

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

/**
 * Creates a {@link ZKClientService}.
 */
protected final ZKClientService createZKClient() {
 TwillRuntimeSpecification twillRuntimeSpec = getTwillRuntimeSpecification();
 return ZKClientServices.delegate(
  ZKClients.namespace(
   ZKClients.reWatchOnExpire(
    ZKClients.retryOnFailure(
     ZKClientService.Builder.of(twillRuntimeSpec.getZkConnectStr()).build(),
     RetryStrategies.fixDelay(1, TimeUnit.SECONDS)
    )
   ), "/" + twillRuntimeSpec.getTwillAppName()
  )
 );
}

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