Search in sources :

Example 1 with ProtocolVersion

use of com.datastax.driver.core.ProtocolVersion in project apex-malhar by apache.

the class CassandraStore method buildCluster.

/**
 * Creates a cluster object.
 */
public void buildCluster() {
    try {
        if (protocolVersion != null && protocolVersion.length() != 0) {
            ProtocolVersion version = getCassandraProtocolVersion();
            cluster = Cluster.builder().addContactPoint(node).withCredentials(userName, password).withProtocolVersion(version).build();
        } else {
            cluster = Cluster.builder().addContactPoint(node).withCredentials(userName, password).build();
        }
    } catch (DriverException ex) {
        throw new RuntimeException("closing database resource", ex);
    } catch (Throwable t) {
        DTThrowable.rethrow(t);
    }
}
Also used : DTThrowable(com.datatorrent.netlet.util.DTThrowable) DriverException(com.datastax.driver.core.exceptions.DriverException) ProtocolVersion(com.datastax.driver.core.ProtocolVersion)

Aggregations

ProtocolVersion (com.datastax.driver.core.ProtocolVersion)1 DriverException (com.datastax.driver.core.exceptions.DriverException)1 DTThrowable (com.datatorrent.netlet.util.DTThrowable)1