final long max_count = 1000000;
final CountingQueueStats stats = new CountingQueueStats();
final ConsistencyLevel cl = ConsistencyLevel.CL_ONE;
final MessageQueue scheduler = new ShardedDistributedMessageQueue.Builder()
.withColumnFamily(SCHEDULER_NAME_CF_NAME)
.withQueueName("StressQueue"+qNameSfx)
.withKeyspace(keyspace)
.withConsistencyLevel(cl)
.withStats(stats)
.withTimeBuckets(10, 30, TimeUnit.SECONDS)
.withShardCount(100)
.withPollInterval(100L, TimeUnit.MILLISECONDS)
.withShardLockManager(slm)
.build();
scheduler.createStorage();
Thread.sleep(1000);
scheduler.createQueue();
final ConcurrentMap<String, Boolean> lookup = Maps.newConcurrentMap();
final int batchSize = 50;
Executors.newSingleThreadExecutor().execute(new Runnable() {
@Override
public void run() {
MessageProducer producer = scheduler.createProducer();
for (int i = 0; i < max_count / batchSize; i++) {
long tm = System.currentTimeMillis();
List<Message> messages = Lists.newArrayList();
for (int j = 0; j < batchSize; j++) {
long id = insertCount.incrementAndGet();