gpt4 book ai didi

org.apache.twill.discovery.ZKDiscoveryService.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 06:30:49 27 4
gpt4 key购买 nike

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

ZKDiscoveryService.<init>介绍

[英]Constructs ZKDiscoveryService using the provided zookeeper client for storing service registry.
[中]使用提供的zookeeper客户端构建ZKDiscoveryService以存储服务注册表。

代码示例

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

ZKDiscoveryService zkDiscoveryService = new ZKDiscoveryService(zkClientService);
PooledClientProvider pooledClientProvider = new PooledClientProvider(
    config, zkDiscoveryService);

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

@Override
 public ZKDiscoveryService get() {
  return new ZKDiscoveryService(zkClient);
 }
}

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

@Override
protected void startUp() throws Exception {
 discoveryService = new ZKDiscoveryService(zkClient);
}

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

@Override
protected void startUp() throws Exception {
 discoveryService = new ZKDiscoveryService(zkClient);
}

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

@Override
protected void startUp() throws Exception {
 discoveryService = new ZKDiscoveryService(zkClient);
}

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

@Override
public PhoenixTransactionService getTransactionService(Configuration config, ConnectionInfo connInfo, int port) {
  config.setInt(TxConstants.Service.CFG_DATA_TX_BIND_PORT, port);
  int retryTimeOut = config.getInt(TxConstants.Service.CFG_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC, 
      TxConstants.Service.DEFAULT_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC);
  ZKClientService zkClient = ZKClientServices.delegate(
   ZKClients.reWatchOnExpire(
    ZKClients.retryOnFailure(
     ZKClientService.Builder.of(connInfo.getZookeeperConnectionString())
      .setSessionTimeout(config.getInt(HConstants.ZK_SESSION_TIMEOUT,
          HConstants.DEFAULT_ZK_SESSION_TIMEOUT))
      .build(),
     RetryStrategies.exponentialDelay(500, retryTimeOut, TimeUnit.MILLISECONDS)
    )
   )
  );
  DiscoveryService discovery = new ZKDiscoveryService(zkClient);
  TransactionManager txManager = new TransactionManager(config, new HDFSTransactionStateStorage(config, 
      new SnapshotCodecProvider(config), new TxMetricsCollector()), new TxMetricsCollector());
  TransactionService txService = new TransactionService(config, zkClient, discovery, Providers.of(txManager));
  TephraTransactionService service = new TephraTransactionService(zkClient, txService);
  service.start();
  return service;
}

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

@Provides
@Singleton
private ZKDiscoveryService providesZKDiscoveryService(ZKClientService zkClient) {
 return new ZKDiscoveryService(zkClient);
}

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

@Provides
 @Singleton
 private ZKDiscoveryService providesDiscoveryService(ZKClient zkClient) {
  return new ZKDiscoveryService(zkClient);
 }
}

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

@Provides
@Singleton
private ZKDiscoveryService providesZKDiscoveryService(ZKClientService zkClient) {
 return new ZKDiscoveryService(zkClient);
}

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

@Provides
 @Singleton
 private ZKDiscoveryService providesDiscoveryService(ZKClient zkClient) {
  return new ZKDiscoveryService(zkClient);
 }
}

代码示例来源:origin: co.cask.tephra/tephra-core

@Provides
@Singleton
private ZKDiscoveryService providesZKDiscoveryService(ZKClientService zkClient) {
 return new ZKDiscoveryService(zkClient);
}

代码示例来源: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: org.apache.twill/twill-core

@Override
public final synchronized ServiceDiscovered discoverService(String serviceName) {
 if (discoveryServiceClient == null) {
  discoveryServiceClient = new ZKDiscoveryService(zkClient);
 }
 return discoveryServiceClient.discover(serviceName);
}

代码示例来源: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.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: apache/twill

@Override
public final synchronized ServiceDiscovered discoverService(String serviceName) {
 if (discoveryServiceClient == null) {
  discoveryServiceClient = new ZKDiscoveryService(zkClient);
 }
 return discoveryServiceClient.discover(serviceName);
}

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

@Override
public PhoenixTransactionService getTransactionService(Configuration config, ConnectionInfo connInfo, int port) {
  config.setInt(TxConstants.Service.CFG_DATA_TX_BIND_PORT, port);
  int retryTimeOut = config.getInt(TxConstants.Service.CFG_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC, 
      TxConstants.Service.DEFAULT_DATA_TX_CLIENT_DISCOVERY_TIMEOUT_SEC);
  ZKClientService zkClient = ZKClientServices.delegate(
   ZKClients.reWatchOnExpire(
    ZKClients.retryOnFailure(
     ZKClientService.Builder.of(connInfo.getZookeeperConnectionString())
      .setSessionTimeout(config.getInt(HConstants.ZK_SESSION_TIMEOUT,
          HConstants.DEFAULT_ZK_SESSION_TIMEOUT))
      .build(),
     RetryStrategies.exponentialDelay(500, retryTimeOut, TimeUnit.MILLISECONDS)
    )
   )
  );
  DiscoveryService discovery = new ZKDiscoveryService(zkClient);
  TransactionManager txManager = new TransactionManager(config, new HDFSTransactionStateStorage(config, 
      new SnapshotCodecProvider(config), new TxMetricsCollector()), new TxMetricsCollector());
  TransactionService txService = new TransactionService(config, zkClient, discovery, Providers.of(txManager));
  TephraTransactionService service = new TephraTransactionService(zkClient, txService);
  service.start();
  return service;
}

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

zkClient.startAndWait();
try (ZKDiscoveryService discoveryService = new ZKDiscoveryService(zkClient)) {

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

@Override
public PhoenixTransactionService getTransactionService(Configuration config, ConnectionInfo connInfo) {
  ZKClientService zkClient = ZKClientServices.delegate(
   ZKClients.reWatchOnExpire(
    ZKClients.retryOnFailure(
     ZKClientService.Builder.of(connInfo.getZookeeperConnectionString())
      .setSessionTimeout(config.getInt(HConstants.ZK_SESSION_TIMEOUT,
          HConstants.DEFAULT_ZK_SESSION_TIMEOUT))
      .build(),
     RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS)
    )
   )
  );
  //zkClient.startAndWait();
  DiscoveryService discovery = new ZKDiscoveryService(zkClient);
  TransactionManager txManager = new TransactionManager(config, new HDFSTransactionStateStorage(config, new SnapshotCodecProvider(config), new TxMetricsCollector()), new TxMetricsCollector());
  TransactionService txService = new TransactionService(config, zkClient, discovery, Providers.of(txManager));
  TephraTransactionService service = new TephraTransactionService(zkClient, txService);
  //txService.startAndWait();            
  service.start();
  return service;
}

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

@Test
public void testServiceStartFailure() throws Exception {
 ZKClientService zkClient = ZKClientService.Builder.of(zkServer.getConnectionStr()).build();
 zkClient.startAndWait();
 try (ZKDiscoveryService discoveryService = new ZKDiscoveryService(zkClient)) {
  // Test the failure on start case
  final TestBalancerService startFailureService = new TestBalancerService("test", 4, zkClient, discoveryService,
                                      discoveryService, true, false);
  startFailureService.startAndWait();
  // The resource balance service should fail
  Tasks.waitFor(Service.State.FAILED, new Callable<Service.State>() {
   @Override
   public Service.State call() throws Exception {
    return startFailureService.state();
   }
  }, 10, TimeUnit.SECONDS, 100, TimeUnit.MILLISECONDS);
 } finally {
  zkClient.stopAndWait();
 }
}

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