Package com.hazelcast.core

Examples of com.hazelcast.core.IQueue.poll()


            }
        }, 1);
        addOperation(operations, new Runnable() {
            public void run() {
                IQueue q = hazelcast.getQueue("myQ");
                q.poll();
            }
        }, 10);
        addOperation(operations, new Runnable() {
            public void run() {
                IQueue q = hazelcast.getQueue("myQ");
View Full Code Here


            }
        }, 1);
        addOperation(operations, new Runnable() {
            public void run() {
                IQueue q = hazelcast.getQueue("myQ");
                q.poll();
            }
        }, 10);
        addOperation(operations, new Runnable() {
            public void run() {
                IQueue q = hazelcast.getQueue("myQ");
View Full Code Here

                                if (q.offer("item")){
                                    totalOffer.incrementAndGet();
                                }
                            }
                            else {
                                if(q.poll() != null){
                                    totalPoll.incrementAndGet();
                                }
                            }
                        }
                        latch.countDown();
View Full Code Here

                    while (running){
                        int size = q.size();
                        if (size > limit){
                            System.out.println("cleaning a little size: " + size);
                            for (int i=0; i < limit/2; i++){
                                if(q.poll() != null){
                                    totalPoll.incrementAndGet();
                                }
                            }
                        }
                        else{
View Full Code Here

        }
        for (int i = 0; i < 10; i++) {
            queue.take();
        }
        for (int i = 0; i < 10; i++) {
            queue.poll();
        }


        final LocalQueueStats stats = queue.getLocalQueueStats();
        AssertTask task = new AssertTask() {
View Full Code Here

    @Test
    public void testEmptyPollOperationCount() {
        IQueue queue = newQueue();

        for (int i = 0; i < 10; i++) {
            queue.poll();
        }

        final LocalQueueStats stats = queue.getLocalQueueStats();
        AssertTask task = new AssertTask() {
            @Override
View Full Code Here

        queue.addItemListener(listener, true);
        for (int i = 0; i < 30; i++) {
            queue.offer("item" + i);
        }
        for (int i = 0; i < 30; i++) {
            queue.poll();
        }
        LocalQueueStats stats = queue.getLocalQueueStats();
        assertOpenEventually(listener.addedLatch);
        assertOpenEventually(listener.removedLatch);
        assertEquals(60, stats.getEventOperationCount());
View Full Code Here

                public void run() {
                    while (true){
                        IQueue q = queues[rnd.nextInt(queueCount)];
                        int random = rnd.nextInt(100);
                        if(random > 65){
                            q.poll();
                            totalPoll.incrementAndGet();
                        }
                        else if(random > 30){
                            q.offer("item");
                            totalOffer.incrementAndGet();
View Full Code Here

        final ItemListenerConfig itemListenerConfig = new ItemListenerConfig(dummyListener, true);
        queueConfig.addItemListenerConfig(itemListenerConfig);
        final HazelcastInstance instance = createHazelcastInstance(config);
        final IQueue queue = instance.getQueue(name);
        queue.offer("item");
        queue.poll();
        assertTrue(dummyListener.latch.await(10, TimeUnit.SECONDS));
    }

    private static class DummyListener implements ItemListener, Serializable {
View Full Code Here

        final String id = queue.addItemListener(listener, true);
        for (int i = 0; i < 10; i++) {
            queue.offer("item" + i);
        }
        for (int i = 0; i < 10; i++) {
            queue.poll();
        }

        assertTrue(latch.await(5, TimeUnit.SECONDS));
        queue.removeItemListener(id);
        queue.offer("item-a");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.