socketOptions.setReadTimeoutMillis(0);
// This defaults to 5 s. Increase to a minute.
socketOptions.setConnectTimeoutMillis(60 * 1000);
Cluster cluster = Cluster.builder()
.addContactPoints(DatabaseDescriptor.getListenAddress())
.withPort(DatabaseDescriptor.getNativeTransportPort())
.withSocketOptions(socketOptions)
// Let's at least log all of the retries so we can see what is happening.
.withRetryPolicy(new LoggingRetryPolicy(Policies.defaultRetryPolicy()))
// The default reconnection policy (exponential) looks fine.
.build();
mCassandraSession = cluster.connect();
} catch (Exception exc) {
throw new KijiIOException(
"Started embedded C* service, but cannot connect to cluster. " + exc);
}
}