Source:
public Optional<CqlClient> constructClient( TaggedMetricRegistry taggedMetricRegistry, CassandraKeyValueServiceConfig config, boolean initializeAsync) { return config.servers().accept(new CassandraServersConfigs.Visitor<Optional<CqlClient>>() { @Override public Optional<CqlClient> visit(CassandraServersConfigs.DefaultConfig defaultConfig) { return Optional.empty(); } @Override public Optional<CqlClient> visit(CassandraServersConfigs.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 Optional.empty(); } Set<InetSocketAddress> servers = cqlCapableConfig.cqlHosts(); Cluster.Builder clusterBuilder = cqlClusterBuilderFactory.get() .addContactPointsWithPorts(servers) .withCredentials(config.credentials().username(), config.credentials().password()) .withCompression(ProtocolOptions.Compression.LZ4) .withRetryPolicy(DefaultRetryPolicy.INSTANCE) .withoutJMXReporting() .withProtocolVersion(ProtocolVersion.V3) .withThreadingOptions(new ThreadingOptions()); clusterBuilder = withSslOptions(clusterBuilder, config); clusterBuilder = withPoolingOptions(clusterBuilder, config); clusterBuilder = withQueryOptions(clusterBuilder, config); clusterBuilder = withLoadBalancingPolicy(clusterBuilder, config, servers); clusterBuilder = withSocketOptions(clusterBuilder, config); return Optional.of(CqlClientImpl.create( taggedMetricRegistry, clusterBuilder.build(), cqlCapableConfig.tuning(), initializeAsync)); } }); }

Target:
public Optional<CqlClient> constructClient( TaggedMetricRegistry taggedMetricRegistry, CassandraKeyValueServiceConfig config, boolean initializeAsync) { return config.servers().accept(new CassandraServersConfigs.Visitor<Optional<CqlClient>>() { @Override public Optional<CqlClient> visit(CassandraServersConfigs.DefaultConfig defaultConfig) { return Optional.empty(); } @Override public Optional<CqlClient> visit(CassandraServersConfigs.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 be falling back to synchronous implementations."); return Optional.empty(); } Set<InetSocketAddress> servers = cqlCapableConfig.cqlHosts(); Cluster.Builder clusterBuilder = cqlClusterBuilderFactory.get() .addContactPointsWithPorts(servers) .withCredentials(config.credentials().username(), config.credentials().password()) .withCompression(ProtocolOptions.Compression.LZ4) .withRetryPolicy(DefaultRetryPolicy.INSTANCE) .withoutJMXReporting() .withProtocolVersion(ProtocolVersion.V3) .withThreadingOptions(new ThreadingOptions()); clusterBuilder = withSslOptions(clusterBuilder, config); clusterBuilder = withPoolingOptions(clusterBuilder, config); clusterBuilder = withQueryOptions(clusterBuilder, config); clusterBuilder = withLoadBalancingPolicy(clusterBuilder, config, servers); clusterBuilder = withSocketOptions(clusterBuilder, config); return Optional.of(CqlClientImpl.create( taggedMetricRegistry, clusterBuilder.build(), cqlCapableConfig.tuning(), initializeAsync)); } }); }