import org.apache.log4j.Logger;
import com.datastax.driver.core.Cluster;
+import com.datastax.driver.core.Configuration;
import com.datastax.driver.core.Host;
import com.datastax.driver.core.Metadata;
+import com.datastax.driver.core.MetricsOptions;
+import com.datastax.driver.core.PoolingOptions;
+import com.datastax.driver.core.ProtocolOptions;
+import com.datastax.driver.core.QueryOptions;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
+import com.datastax.driver.core.SocketOptions;
import com.datastax.driver.core.Session;
+import com.datastax.driver.core.policies.Policies;
+
import compbio.engine.ProteoCachePropertyHelperManager;
import compbio.util.PropertyHelper;
CASSANDRA_HOSTNAME = cassandrahostname;
}
- cluster = Cluster.builder().addContactPoint(CASSANDRA_HOSTNAME).build();
+ Cluster.Builder builder = Cluster.builder();
+ builder.addContactPoint(CASSANDRA_HOSTNAME);
+ //PrintClusterConfiguration( builder.getConfiguration());
+ cluster = builder.build();
Metadata metadata = cluster.getMetadata();
System.out.printf("Connected to cluster: %s\n", metadata.getClusterName());
return cal.getTimeInMillis();
}
+ private void PrintClusterConfiguration(Configuration cc) {
+ Policies policies = cc.getPolicies();
+ SocketOptions sopt = cc.getSocketOptions();
+ ProtocolOptions propt = cc.getProtocolOptions();
+ PoolingOptions plopt = cc.getPoolingOptions();
+ MetricsOptions mopt = cc.getMetricsOptions();
+ QueryOptions qopt = cc.getQueryOptions();
+ System.out.println("Cluster configuration:");
+ System.out.println(" Policies = " + policies.toString());
+ System.out.println(" Socket Options = " + sopt.toString());
+ System.out.println(" Protocol Options: compression = " + propt.getCompression());
+ System.out.println(" Pooling Options = " + plopt.toString());
+ System.out.println(" Metrics Options = " + mopt.toString());
+ System.out.println(" Query Options = " + qopt.toString());
+ }
+
}