Package com.netflix.astyanax.recipes.queue

Examples of com.netflix.astyanax.recipes.queue.MessageQueue


        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();
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.recipes.queue.MessageQueue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.