Search in sources :

Example 1 with Compression

use of com.datastax.driver.core.ProtocolOptions.Compression in project zeppelin by apache.

the class CassandraInterpreter method open.

@Override
public void open() {
    final String[] addresses = getProperty(CASSANDRA_HOSTS).split(",");
    final int port = parseInt(getProperty(CASSANDRA_PORT));
    StringBuilder hosts = new StringBuilder();
    for (String address : addresses) {
        hosts.append(address).append(",");
    }
    LOGGER.info("Bootstrapping Cassandra Java Driver to connect to " + hosts.toString() + "on port " + port);
    Compression compression = driverConfig.getCompressionProtocol(this);
    cluster = Cluster.builder().addContactPoints(addresses).withPort(port).withProtocolVersion(driverConfig.getProtocolVersion(this)).withClusterName(getProperty(CASSANDRA_CLUSTER_NAME)).withCompression(compression).withCredentials(getProperty(CASSANDRA_CREDENTIALS_USERNAME), getProperty(CASSANDRA_CREDENTIALS_PASSWORD)).withLoadBalancingPolicy(driverConfig.getLoadBalancingPolicy(this)).withRetryPolicy(driverConfig.getRetryPolicy(this)).withReconnectionPolicy(driverConfig.getReconnectionPolicy(this)).withSpeculativeExecutionPolicy(driverConfig.getSpeculativeExecutionPolicy(this)).withMaxSchemaAgreementWaitSeconds(parseInt(getProperty(CASSANDRA_MAX_SCHEMA_AGREEMENT_WAIT_SECONDS))).withPoolingOptions(driverConfig.getPoolingOptions(this)).withQueryOptions(driverConfig.getQueryOptions(this)).withSocketOptions(driverConfig.getSocketOptions(this)).build();
    session = cluster.connect();
    helper = new InterpreterLogic(session);
}
Also used : Compression(com.datastax.driver.core.ProtocolOptions.Compression)

Aggregations

Compression (com.datastax.driver.core.ProtocolOptions.Compression)1