Java 类com.datastax.driver.core.AtomicMonotonicTimestampGenerator 实例源码

项目:camunda-engine-cassandra    文件:CassandraProcessEngineConfiguration.java   
protected void initCassandraClient() {
  if(keyspace == null) {
    keyspace = DEFAULT_KEYSPACE;
  }

  if(cluster == null) {
    cluster = Cluster.builder()
      .addContactPoint(cassandraContactPoint)
      .withTimestampGenerator(new AtomicMonotonicTimestampGenerator())
      .build();
    hasOpenedCluster = true;
  }

  // make sure the keyspace exists (create it with default replication settings otherwise)
  KeyspaceMetadata existingKeyspace = cluster.getMetadata().getKeyspace("camunda");
  if(existingKeyspace == null) {
    final Session session = cluster.connect();
    session.execute(String.format("CREATE keyspace %s WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : " + replicationFactor + " };", keyspace));
    session.close();
  }

  if(session == null) {
    session = cluster.connect(keyspace);
  }
}
项目:sunbird-utils    文件:CassandraConnectionManagerImpl.java   
/**
 * @param ip String
 * @param port String
 * @param poolingOptions PoolingOptions
 * @return Cluster Cluster
 */
private static Cluster createCluster(String ip, String port, PoolingOptions poolingOptions) {
  return Cluster.builder().addContactPoint(ip).withPort(Integer.parseInt(port))
      .withProtocolVersion(ProtocolVersion.V3).withRetryPolicy(DefaultRetryPolicy.INSTANCE)
      .withTimestampGenerator(new AtomicMonotonicTimestampGenerator())
      .withPoolingOptions(poolingOptions).build();
}
项目:state-channels    文件:CassandraConfiguration.java   
@Bean
public TimestampGenerator getTimestampGenerator() {
    return new AtomicMonotonicTimestampGenerator();
}
项目:sunbird-utils    文件:CassandraConnectionManagerImpl.java   
/**
 * @param ip String
 * @param port String
 * @param userName String
 * @param password String
 * @param poolingOptions PoolingOptions
 * @return Cluster Cluster
 */
private static Cluster createCluster(String ip, String port, String userName, String password,
    PoolingOptions poolingOptions) {
  return Cluster.builder().addContactPoint(ip).withPort(Integer.parseInt(port))
      .withProtocolVersion(ProtocolVersion.V3).withRetryPolicy(DefaultRetryPolicy.INSTANCE)
      .withTimestampGenerator(new AtomicMonotonicTimestampGenerator())
      .withPoolingOptions(poolingOptions).withCredentials(userName, password).build();
}