类org.apache.zookeeper.client.ZKClientConfig源码实例Demo

下面列出了怎么用org.apache.zookeeper.client.ZKClientConfig的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: strimzi-kafka-operator   文件: ZookeeperScaler.java
/**
 * Generates the TLS configuration for Zookeeper.
 *
 * @return
 */
private ZKClientConfig getClientConfig()  {
    ZKClientConfig clientConfig = new ZKClientConfig();

    clientConfig.setProperty("zookeeper.clientCnxnSocket", "org.apache.zookeeper.ClientCnxnSocketNetty");
    clientConfig.setProperty("zookeeper.client.secure", "true");
    clientConfig.setProperty("zookeeper.ssl.trustStore.location", trustStoreFile.getAbsolutePath());
    clientConfig.setProperty("zookeeper.ssl.trustStore.password", trustStorePassword);
    clientConfig.setProperty("zookeeper.ssl.trustStore.type", "PKCS12");
    clientConfig.setProperty("zookeeper.ssl.keyStore.location", keyStoreFile.getAbsolutePath());
    clientConfig.setProperty("zookeeper.ssl.keyStore.password", keyStorePassword);
    clientConfig.setProperty("zookeeper.ssl.keyStore.type", "PKCS12");

    return clientConfig;
}
 
源代码2 项目: vespa   文件: Curator.java
private static ZKClientConfig createClientConfig(Optional<File> clientConfigFile) {
    if (clientConfigFile.isPresent()) {
        boolean useSecureClient = Boolean.parseBoolean(getEnvironmentVariable("VESPA_USE_TLS_FOR_ZOOKEEPER_CLIENT").orElse("false"));
        String config = "zookeeper.client.secure=" + useSecureClient + "\n";
        clientConfigFile.get().getParentFile().mkdirs();
        IOUtils.writeFile(clientConfigFile.get(), Utf8.toBytes(config));
        try {
            return new ZKClientConfig(clientConfigFile.get());
        } catch (QuorumPeerConfig.ConfigException e) {
            throw new RuntimeException("Unable to create ZooKeeper client config file " + clientConfigFile.get());
        }
    } else {
        return new ZKClientConfig();
    }
}
 
源代码3 项目: ignite   文件: ZkTestClientCnxnSocketNIO.java
/**
 * @throws IOException If failed.
 */
public ZkTestClientCnxnSocketNIO(ZKClientConfig clientCfg) throws IOException {
    super(clientCfg);

    String threadName = Thread.currentThread().getName();

    nodeName = threadName.substring(threadName.indexOf('-') + 1);

    if (DEBUG)
        log.info("ZkTestClientCnxnSocketNIO created for node: " + nodeName);
}
 
源代码4 项目: vespa   文件: VespaZooKeeperFactory.java
VespaZooKeeperFactory(ZKClientConfig zkClientConfig) {
    this.zkClientConfig = zkClientConfig;
}
 
/**
 * Creates an instance of ZooKeeperAdmin
 *
 * @throws      IOException might be thrown
 *
 * @param connectString     Connection String used to connect to Zookeeper
 * @param sessionTimeout    Session timeout
 * @param watcher           Watcher which will be notified about watches and connection changes
 * @param conf              Zookeeper client configuration
 *
 * @return  ZooKeeperAdmin instance
 */
ZooKeeperAdmin createZookeeperAdmin(String connectString, int sessionTimeout, Watcher watcher, ZKClientConfig conf) throws IOException;
 
/**
 * Creates an instance of ZooKeeperAdmin
 *
 * @param connectString     Connection String used to connect to Zookeeper
 * @param sessionTimeout    Session timeout
 * @param watcher           Watcher which will be notified about watches and connection changes
 * @param conf              Zookeeper client configuration
 *
 * @return  ZooKeeperAdmin instance
 */
@Override
public ZooKeeperAdmin createZookeeperAdmin(String connectString, int sessionTimeout, Watcher watcher, ZKClientConfig conf) throws IOException {
    return new ZooKeeperAdmin(connectString, sessionTimeout, watcher, conf);
}
 
 类所在包
 类方法
 同包方法