Package com.hazelcast.monitor

Examples of com.hazelcast.monitor.LocalQueueStats


    doc.field("serviceName", queue.getServiceName());

    doc.field("size", queue.size());
    // doc.field("nextElement", queue.peek());

    final LocalQueueStats stats = queue.getLocalQueueStats();
    doc.field("minAge", stats.getMinAge());
    doc.field("maxAge", stats.getMaxAge());
    doc.field("avgAge", stats.getAvgAge());

    doc.field("backupItemCount", stats.getBackupItemCount());
    doc.field("emptyPollOperationCount", stats.getEmptyPollOperationCount());
    doc.field("offerOperationCount", stats.getOfferOperationCount());
    doc.field("eventOperationCount", stats.getEventOperationCount());
    doc.field("otherOperationsCount", stats.getOtherOperationsCount());
    doc.field("pollOperationCount", stats.getPollOperationCount());
    doc.field("emptyPollOperationCount", stats.getEmptyPollOperationCount());
    doc.field("ownedItemCount", stats.getOwnedItemCount());
    doc.field("rejectedOfferOperationCount", stats.getRejectedOfferOperationCount());

    List<Object> nextMessages = new ArrayList<Object>(STATS_MAX_MESSAGES);
    for (Iterator<Object> it = queue.iterator(); it.hasNext();) {
      Object next = it.next();
      if (next != null)
View Full Code Here


        IQueue queue = newQueue();
        int items = 20;
        for (int i = 0; i < items; i++) {
            queue.offer("item" + i);
        }
        LocalQueueStats stats = queue.getLocalQueueStats();
        assertEquals(20, stats.getOwnedItemCount());
        assertEquals(0, stats.getBackupItemCount());
    }
View Full Code Here

        }
        for (int i = 0; i < 10; i++) {
            queue.put("item" + i);
        }

        final LocalQueueStats stats = queue.getLocalQueueStats();
        AssertTask task = new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals(30, stats.getOfferOperationCount());
            }
        };
        assertTrueEventually(task);
    }
View Full Code Here

        for (int i = 0; i < 10; i++) {
            queue.offer("item" + i);
        }

        final LocalQueueStats stats = queue.getLocalQueueStats();
        AssertTask task = new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals(10, stats.getRejectedOfferOperationCount());
            }
        };
        assertTrueEventually(task);

    }
View Full Code Here

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


        final LocalQueueStats stats = queue.getLocalQueueStats();
        AssertTask task = new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals(30, stats.getPollOperationCount());
            }
        };
        assertTrueEventually(task);
    }
View Full Code Here

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

        final LocalQueueStats stats = queue.getLocalQueueStats();
        AssertTask task = new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals(10, stats.getEmptyPollOperationCount());
            }
        };
        assertTrueEventually(task);
    }
View Full Code Here

        ArrayList<String> list = new ArrayList<String>();
        queue.drainTo(list);
        queue.addAll(list);
        queue.removeAll(list);

        final LocalQueueStats stats = queue.getLocalQueueStats();
        AssertTask task = new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals(3, stats.getOtherOperationsCount());
            }
        };
        assertTrueEventually(task);
    }
View Full Code Here

    public void testAge() {
        IQueue queue = newQueue();
        queue.offer("maxAgeItem");
        queue.offer("minAgeItem");

        LocalQueueStats stats = queue.getLocalQueueStats();
        long maxAge = stats.getMaxAge();
        long minAge = stats.getMinAge();
        long testAge = (maxAge + minAge) / 2;
        long avgAge = stats.getAvgAge();
        assertEquals(testAge, avgAge);
    }
View Full Code Here

            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

    }
   
    // Shut down listener thread
    isActive = false;
   
    LocalQueueStats localQueueStats = jobQueue.getLocalQueueStats();
    logger.info("This async job executor has processed " + localQueueStats.getPollOperationCount());

    // Shut down hazelcast
    try {
      hazelcastInstance.shutdown();
    } catch (HazelcastInstanceNotActiveException e) {
View Full Code Here

TOP

Related Classes of com.hazelcast.monitor.LocalQueueStats

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.