Source:
public CqlClient constructClient( TaggedMetricRegistry taggedMetricRegistry, CassandraKeyValueServiceConfig config, boolean initializeAsync) { return config.servers().accept(new CassandraServersConfigs.Visitor<CqlClient>() { @Override public CqlClient visit(CassandraServersConfigs.DefaultConfig defaultConfig) { return ThrowingCqlClientImpl.SINGLETON; } @Override public CqlClient visit(CqlCapableConfig cqlCapableConfig) { if (!cqlCapableConfig.validateHosts()) { log.warn("Your CQL capable config is wrong, the hosts for CQL and Thrift are not the same, using " + "async API will result in an exception."); return ThrowingCqlClientImpl.SINGLETON; } Set<InetSocketAddress> servers = cqlCapableConfig.cqlHosts(); DriverConfigLoader loader = DriverConfigLoader.programmaticBuilder() .withString(DefaultDriverOption.LOAD_BALANCING_POLICY_CLASS, LOAD_BALANCING_POLICY) .withString(DefaultDriverOption.PROTOCOL_COMPRESSION, COMPRESSION_PROTOCOL) .withInt(DefaultDriverOption.CONNECTION_POOL_LOCAL_SIZE, config.poolSize()) .withInt(DefaultDriverOption.CONNECTION_POOL_REMOTE_SIZE, config.poolSize()) .withInt(DefaultDriverOption.REQUEST_PAGE_SIZE, config.fetchBatchCount()) .build(); Supplier<CqlSession> cqlSessionSupplier = () -> { CqlSessionBuilder cqlSessionBuilder = withSocksProxy(cqlCapableConfig); cqlSessionBuilder.addContactPoints(servers) .withAuthCredentials(config.credentials().username(), config.credentials().password()) .withConfigLoader(loader); return withSslOptions(cqlSessionBuilder, config).build(); }; return CqlClientImpl.create( taggedMetricRegistry, cqlSessionSupplier, cqlCapableConfig.tuning(), initializeAsync); } }); }

Target:
public CqlClient constructClient( TaggedMetricRegistry taggedMetricRegistry, CassandraKeyValueServiceConfig config, boolean initializeAsync) { return config.servers().accept(new CassandraServersConfigs.Visitor<CqlClient>() { @Override public CqlClient visit(CassandraServersConfigs.DefaultConfig defaultConfig) { return ThrowingCqlClientImpl.INSTANCE; } @Override public CqlClient visit(CqlCapableConfig cqlCapableConfig) { if (!cqlCapableConfig.thriftAndCqlHostsMatch()) { log.warn("Your CQL capable config is wrong, the hosts for CQL and Thrift are not the same, using " + "async API will result in an exception."); return ThrowingCqlClientImpl.INSTANCE; } Set<InetSocketAddress> servers = cqlCapableConfig.cqlHosts(); DriverConfigLoader loader = DriverConfigLoader.programmaticBuilder() .withString(DefaultDriverOption.LOAD_BALANCING_POLICY_CLASS, LOAD_BALANCING_POLICY) .withString(DefaultDriverOption.PROTOCOL_COMPRESSION, COMPRESSION_PROTOCOL) .withInt(DefaultDriverOption.CONNECTION_POOL_LOCAL_SIZE, config.poolSize()) .withInt(DefaultDriverOption.CONNECTION_POOL_REMOTE_SIZE, config.poolSize()) .withInt(DefaultDriverOption.REQUEST_PAGE_SIZE, config.fetchBatchCount()) .build(); Supplier<CqlSession> cqlSessionSupplier = () -> { CqlSessionBuilder cqlSessionBuilder = withSocksProxy(cqlCapableConfig); cqlSessionBuilder.addContactPoints(servers) .withAuthCredentials(config.credentials().username(), config.credentials().password()) .withConfigLoader(loader); return withSslOptions(cqlSessionBuilder, config).build(); }; return CqlClientImpl.create( taggedMetricRegistry, cqlSessionSupplier, cqlCapableConfig.tuning(), initializeAsync); } }); }