org.I0Itec.zkclient.ZkClient.close()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(204)

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

ZkClient.close介绍

暂无

代码示例

代码示例来源:origin: weibocom/motan

@Override
  public void close() {
    this.zkClient.close();
  }
}

代码示例来源:origin: ltsopensource/light-task-scheduler

@Override
  protected void doClose() {
    zkClient.close();
  }
}

代码示例来源:origin: ltsopensource/light-task-scheduler

@Override
  protected void doClose() {
    zkClient.close();
  }
}

代码示例来源:origin: linkedin/cruise-control

void shutdown() {
 _zkClient.close();
}

代码示例来源:origin: apache/incubator-dubbo

public void close() {
  Assert.notNull(client, new IllegalStateException("Zookeeper is not connected yet!"));
  client.close();
}

代码示例来源:origin: apache/incubator-dubbo

public void close() {
  Assert.notNull(client, new IllegalStateException("Zookeeper is not connected yet!"));
  client.close();
}

代码示例来源:origin: crossoverJie/cim

/**
   * 关闭 ZK
   */
  public void closeZK() {
    logger.info("正在关闭 ZK");
    zkClient.close();
    logger.info("关闭 ZK 成功");

  }
}

代码示例来源:origin: apache/incubator-gobblin

void shutdown() {
 if (_numStarted.decrementAndGet() == 0) {
  log.info("Shutting down Kafka server suite");
  _kafkaServer.shutdown();
  _zkClient.close();
  _zkServer.shutdown();
 }
 else {
  log.info("Kafka server suite still in use ... not shutting down yet");
 }
}

代码示例来源:origin: apache/incubator-gobblin

void shutdown() {
 if (_numStarted.decrementAndGet() == 0) {
  log.info("Shutting down Kafka server suite");
  _kafkaServer.shutdown();
  _zkClient.close();
  _zkServer.shutdown();
 }
 else {
  log.info("Kafka server suite still in use ... not shutting down yet");
 }
}

代码示例来源:origin: apache/incubator-pinot

public static KafkaServerStartable startServer(final int port, final int brokerId, final String zkStr,
  final String logDirPath, final Properties configuration) {
 // Create the ZK nodes for Kafka, if needed
 int indexOfFirstSlash = zkStr.indexOf('/');
 if (indexOfFirstSlash != -1) {
  String bareZkUrl = zkStr.substring(0, indexOfFirstSlash);
  String zkNodePath = zkStr.substring(indexOfFirstSlash);
  ZkClient client = new ZkClient(bareZkUrl);
  client.createPersistent(zkNodePath, true);
  client.close();
 }
 File logDir = new File(logDirPath);
 logDir.mkdirs();
 configureKafkaPort(configuration, port);
 configureZkConnectionString(configuration, zkStr);
 configureBrokerId(configuration, brokerId);
 configureKafkaLogDirectory(configuration, logDir);
 configuration.put("zookeeper.session.timeout.ms", "60000");
 KafkaConfig config = new KafkaConfig(configuration);
 KafkaServerStartable serverStartable = new KafkaServerStartable(config);
 serverStartable.startup();
 return serverStartable;
}

代码示例来源:origin: apache/incubator-pinot

client.close();

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

@Override
public void deleteTestTopic(String topic) {
  ZkUtils zkUtils = getZkUtils();
  try {
    LOG.info("Deleting topic {}", topic);
    ZkClient zk = new ZkClient(zookeeperConnectionString, Integer.valueOf(standardProps.getProperty("zookeeper.session.timeout.ms")),
      Integer.valueOf(standardProps.getProperty("zookeeper.connection.timeout.ms")), new ZooKeeperStringSerializer());
    AdminUtils.deleteTopic(zkUtils, topic);
    zk.close();
  } finally {
    zkUtils.close();
  }
}

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

@Override
public void deleteTestTopic(String topic) {
  ZkUtils zkUtils = getZkUtils();
  try {
    LOG.info("Deleting topic {}", topic);
    ZkClient zk = new ZkClient(zookeeperConnectionString, Integer.valueOf(standardProps.getProperty("zookeeper.session.timeout.ms")),
      Integer.valueOf(standardProps.getProperty("zookeeper.connection.timeout.ms")), new ZooKeeperStringSerializer());
    AdminUtils.deleteTopic(zkUtils, topic);
    zk.close();
  } finally {
    zkUtils.close();
  }
}

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

@Override
public void deleteTestTopic(String topic) {
  ZkUtils zkUtils = getZkUtils();
  try {
    LOG.info("Deleting topic {}", topic);
    ZkClient zk = new ZkClient(zookeeperConnectionString, Integer.valueOf(standardProps.getProperty("zookeeper.session.timeout.ms")),
      Integer.valueOf(standardProps.getProperty("zookeeper.connection.timeout.ms")), new ZooKeeperStringSerializer());
    AdminUtils.deleteTopic(zkUtils, topic);
    zk.close();
  } finally {
    zkUtils.close();
  }
}

代码示例来源:origin: apache/incubator-gobblin

public static void closeServer() {
 if (serverStarted && !serverClosed) {
  serverClosed = true;
  kafkaServer.shutdown();
  zkClient.close();
  zkServer.shutdown();
 }
}

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

} finally {
  try {
    zkClient.close();
  } catch (Exception e2) {

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

@AfterClass
public static void tearDownCluster() throws Exception {
 synchronized (TestKafkaSuit.class) {
  if (initCount.decrementAndGet() == 0) {
   if (zkClient != null) {
    zkClient.close();
   }
   if (embeddedKafkaCluster != null && !embeddedKafkaCluster.getBrokers().isEmpty()) {
    embeddedKafkaCluster.shutDownCluster();
   }
  }
 }
}

代码示例来源:origin: apache/incubator-pinot

@AfterTest
public void tearDown() {
 _pinotHelixResourceManager.stop();
 _zkClient.close();
 ZkStarter.stopLocalZkServer(_zookeeperInstance);
}

代码示例来源:origin: apache/incubator-pinot

@AfterTest
public void tearDown() {
 _pinotResourceManager.stop();
 _zkClient.close();
 ZkStarter.stopLocalZkServer(_zookeeperInstance);
}

代码示例来源:origin: apache/incubator-pinot

@Test
public void testGetInstanceConfigs()
  throws Exception {
 Set<String> servers = _helixResourceManager.getAllInstancesForServerTenant(SERVER_TENANT_NAME);
 for (String server : servers) {
  InstanceConfig cachedInstanceConfig = _helixResourceManager.getHelixInstanceConfig(server);
  InstanceConfig realInstanceConfig = _helixAdmin.getInstanceConfig(_helixClusterName, server);
  Assert.assertEquals(cachedInstanceConfig, realInstanceConfig);
 }
 ZkClient zkClient = new ZkClient(_helixResourceManager.getHelixZkURL(), CONNECTION_TIMEOUT_IN_MILLISECOND,
   CONNECTION_TIMEOUT_IN_MILLISECOND, new ZNRecordSerializer());
 modifyExistingInstanceConfig(zkClient);
 addAndRemoveNewInstanceConfig(zkClient);
 zkClient.close();
}

相关文章