gpt4 book ai didi

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

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

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

ZkClient.<init>介绍

暂无

代码示例

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

public ZkClientWrapper(final String serverAddr, long timeout) {
  this.timeout = timeout;
  completableFuture = CompletableFuture.supplyAsync(() -> new ZkClient(serverAddr, Integer.MAX_VALUE));
}

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

public ZkClientWrapper(final String serverAddr, long timeout) {
  this.timeout = timeout;
  completableFuture = CompletableFuture.supplyAsync(() -> new ZkClient(serverAddr, Integer.MAX_VALUE));
}

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

protected ZkClient createInnerZkClient(String zkServers, int sessionTimeout, int connectionTimeout) {
    return new ZkClient(zkServers, sessionTimeout, connectionTimeout);
  }
}

代码示例来源:origin: networknt/light-4j

public ZooKeeperClientImpl(String zkServers, int sessionTimeout, int connectionTimeout) {
  zkClient = new ZkClient(zkServers, sessionTimeout, connectionTimeout);
}

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

@Bean
public ZkClient buildZKClient(){
  return new ZkClient(appConfiguration.getZkAddr(), 5000);
}

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

@Bean
public ZkClient buildZKClient(){
  return new ZkClient(appConfiguration.getZkAddr(), 5000);
}

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

@Bean
public ZkClient buildZKClient(){
  return new ZkClient(appConfiguration.getZkAddr(), 5000);
}

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

@Override
  protected ZkClient createInnerZkClient(String zkServers, int sessionTimeout, int connectionTimeout) {
    return new ZkClient(zkServers, sessionTimeout, connectionTimeout, new StringSerializer());
  }
}

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

@PostConstruct
void init() {
  try {
    zkClient = new ZkClient(registryUrl, 10000, 10000, new StringSerializer());
  } catch (Exception e) {
    throw new MotanFrameworkException("Fail to connect zookeeper, cause: " + e.getMessage());
  }
}

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

public ZkUtils getZkUtils() {
  LOG.info("In getZKUtils:: zookeeperConnectionString = {}", zookeeperConnectionString);
  ZkClient creator = new ZkClient(zookeeperConnectionString, Integer.valueOf(standardProps.getProperty("zookeeper.session.timeout.ms")),
      Integer.valueOf(standardProps.getProperty("zookeeper.connection.timeout.ms")), new ZooKeeperStringSerializer());
  return ZkUtils.apply(creator, false);
}

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

public ZkUtils getZkUtils() {
  ZkClient creator = new ZkClient(zookeeperConnectionString, Integer.valueOf(standardProps.getProperty("zookeeper.session.timeout.ms")),
      Integer.valueOf(standardProps.getProperty("zookeeper.connection.timeout.ms")), new ZooKeeperStringSerializer());
  return ZkUtils.apply(creator, false);
}

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

public ZkUtils getZkUtils() {
  ZkClient creator = new ZkClient(zookeeperConnectionString, Integer.valueOf(standardProps.getProperty("zookeeper.session.timeout.ms")),
      Integer.valueOf(standardProps.getProperty("zookeeper.connection.timeout.ms")), new ZooKeeperStringSerializer());
  return ZkUtils.apply(creator, false);
}

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

public ZkClientZkClient(Config config) {
  String registryAddress = NodeRegistryUtils.getRealRegistryAddress(config.getRegistryAddress());
  zkClient = new ZkClient(registryAddress, connectionTimeout);
  zkClient.subscribeStateChanges(new IZkStateListener() {
    public void handleStateChanged(Watcher.Event.KeeperState state) throws Exception {
      ZkClientZkClient.this.state = state;
      if (state == KeeperState.Disconnected) {
        stateChanged(StateListener.DISCONNECTED);
      } else if (state == KeeperState.SyncConnected) {
        stateChanged(StateListener.CONNECTED);
      } else if (state == KeeperState.Expired) {
        stateChanged(StateListener.DISCONNECTED);
      }
    }
    public void handleNewSession() throws Exception {
      stateChanged(StateListener.RECONNECTED);
    }
  });
}

代码示例来源: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 void startCluster() {
  // Start Zookeeper.
  _zkServer = new EmbeddedZookeeper();
  _zkConnectString = "127.0.0.1:"+_zkServer.port();
  _zkClient = new ZkClient(_zkConnectString, 30000, 30000, ZKStringSerializer$.MODULE$);
  // Start Kafka Cluster.
  for(int i=0;i<clusterCount;i++) {
    KafkaServer _kafkaServer = createKafkaServer(i,_zkConnectString);
    kafkaBrokerList.add(_kafkaServer);
  }
}

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

public DynamicBrokerSelector(String zkServers) {
 ZkClient zkClient = new ZkClient(zkServers);
 zkClient.setZkSerializer(new BytesPushThroughSerializer());
 zkClient.waitUntilConnected(60, TimeUnit.SECONDS);
 zkClient.subscribeDataChanges(ExternalViewReader.BROKER_EXTERNAL_VIEW_PATH, this);
 evReader = new ExternalViewReader(zkClient);
 refresh();
}

代码示例来源: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();
}

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

public static void startServer() throws RuntimeException {
 if (serverStarted && serverClosed) {
  throw new RuntimeException("Kafka test server has already been closed. Cannot generate Kafka server twice.");
 }
 if (!serverStarted) {
  serverStarted = true;
  zkConnect = TestZKUtils.zookeeperConnect();
  zkServer = new EmbeddedZookeeper(zkConnect);
  zkClient = new ZkClient(zkServer.connectString(), 30000, 30000, ZKStringSerializer$.MODULE$);
  kafkaPort = TestUtils.choosePort();
  Properties props = TestUtils.createBrokerConfig(brokerId, kafkaPort, true);
  KafkaConfig config = new KafkaConfig(props);
  Time mock = new MockTime();
  kafkaServer = TestUtils.createServer(config, mock);
 }
}

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