Java Code Examples for com.datastax.driver.core.BatchStatement#Type

The following examples show how to use com.datastax.driver.core.BatchStatement#Type . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BatchTests.java    From stratio-cassandra with Apache License 2.0 6 votes vote down vote up
public void sendBatch(BatchStatement.Type type, boolean addCounter, boolean addNonCounter)
{

    assert addCounter || addNonCounter;
    BatchStatement b = new BatchStatement(type);

    for (int i = 0; i < 10; i++)
    {
        if (addNonCounter)
            b.add(noncounter.bind(i, "foo"));

        if (addCounter)
            b.add(counter.bind((long)i, i));
    }

    session.execute(b);
}
 
Example 2
Source File: CassandraManager.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
private FactoryData(final SocketAddress[] contactPoints, final ColumnMapping[] columns, final boolean useTls,
                    final String clusterName, final String keyspace, final String table, final String username,
                    final String password, final boolean useClockForTimestampGenerator, final int bufferSize,
                    final boolean batched, final BatchStatement.Type batchType) {
    super(bufferSize, null);
    this.contactPoints = convertAndAddDefaultPorts(contactPoints);
    this.columns = columns;
    this.useTls = useTls;
    this.clusterName = clusterName;
    this.keyspace = keyspace;
    this.table = table;
    this.username = username;
    this.password = password;
    this.useClockForTimestampGenerator = useClockForTimestampGenerator;
    this.batched = batched;
    this.batchType = batchType;
}
 
Example 3
Source File: SaveToCassandraActionExecutionFunction.java    From Decision with Apache License 2.0 5 votes vote down vote up
public SaveToCassandraActionExecutionFunction(String cassandraQuorum, int cassandraPort, int maxBatchSize,
        BatchStatement.Type batchType) {
    this.cassandraQuorum = cassandraQuorum;
    this.cassandraPort = cassandraPort;
    this.maxBatchSize = maxBatchSize;
    this.batchType = batchType;
}
 
Example 4
Source File: CassandraManager.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
public static CassandraManager getManager(final String name, final SocketAddress[] contactPoints,
                                          final ColumnMapping[] columns, final boolean useTls,
                                          final String clusterName, final String keyspace, final String table,
                                          final String username, final String password,
                                          final boolean useClockForTimestampGenerator, final int bufferSize,
                                          final boolean batched, final BatchStatement.Type batchType) {
    return getManager(name,
        new FactoryData(contactPoints, columns, useTls, clusterName, keyspace, table, username, password,
            useClockForTimestampGenerator, bufferSize, batched, batchType), CassandraManagerFactory.INSTANCE);
}
 
Example 5
Source File: SchemaInsert.java    From stratio-cassandra with Apache License 2.0 4 votes vote down vote up
public SchemaInsert(Timer timer, StressSettings settings, PartitionGenerator generator, SeedManager seedManager, Distribution batchSize, RatioDistribution useRatio, Integer thriftId, PreparedStatement statement, ConsistencyLevel cl, BatchStatement.Type batchType)
{
    super(timer, settings, new DataSpec(generator, seedManager, batchSize, useRatio), statement, thriftId, cl, ValidationType.NOT_FAIL);
    this.batchType = batchType;
}
 
Example 6
Source File: ConfigurationContext.java    From Decision with Apache License 2.0 4 votes vote down vote up
public BatchStatement.Type getCassandraBatchType() {
    return cassandraBatchType;
}
 
Example 7
Source File: SaveToCassandraActionExecutionFunction.java    From Decision with Apache License 2.0 4 votes vote down vote up
public SaveToCassandraActionExecutionFunction(String cassandraQuorum, int cassandraPort, int maxBatchSize,
        BatchStatement.Type batchType, SaveToCassandraOperationsService
        cassandraTableOperationsService) {
   this(cassandraQuorum, cassandraPort, maxBatchSize, batchType);
   this.cassandraTableOperationsService = cassandraTableOperationsService;
}
 
Example 8
Source File: CassandraAppender.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
public B setBatchType(final BatchStatement.Type batchType) {
    this.batchType = batchType;
    return asBuilder();
}