Package org.apache.servicemix.nmr.management.stats

Examples of org.apache.servicemix.nmr.management.stats.CountStatistic


    protected final TimeStatistic outboundExchangeRate;

    public ManagedEndpoint(InternalEndpoint endpoint, Map<String,?> properties) {
        this.endpoint = endpoint;
        this.properties = new HashMap<String,Object>(properties);
        this.inboundExchanges = new CountStatistic("inboundExchanges", "Number of exchanges received");
        this.inboundExchangeRate = new TimeStatistic("inboundExchangeRate", "Number of exchanges received per second");
        this.outboundExchanges = new CountStatistic("outboundExchanges", "Number of exchanges sent");
        this.outboundExchangeRate = new TimeStatistic("outboundExchangeRate", "Number of exchanges sent per second");
    }
View Full Code Here


    /**
     * Use case for CountStatisticImple class.
     * @throws Exception
     */
    public void testStatistic() throws Exception {
        CountStatistic stat = new CountStatistic("myCounter", "seconds", "myDescription");
        assertStatistic(stat, "myCounter", "seconds", "myDescription");

        assertEquals(0, stat.getCount());

        stat.increment();
        assertEquals(1, stat.getCount());

        stat.increment();
        assertEquals(2, stat.getCount());

        stat.decrement();
        assertEquals(1, stat.getCount());

        Thread.sleep(500);

        stat.increment();

        assertLastTimeNotStartTime(stat);

        LOG.info("Counter is: " + stat);

        stat.reset();

        assertEquals(0, stat.getCount());
    }
View Full Code Here

    /**
     * Use case for CountStatisticImple class.
     * @throws Exception
     */
    public void testStatistic() throws Exception {
        CountStatistic stat = new CountStatistic("myCounter", "seconds", "myDescription");
        assertStatistic(stat, "myCounter", "seconds", "myDescription");

        assertEquals(0, stat.getValue());

        stat.increment();
        assertEquals(1, stat.getValue());
        assertEquals(1, stat.getUpdateCount());

        stat.increment();
        assertEquals(2, stat.getValue());
        assertEquals(2, stat.getUpdateCount());

        stat.decrement();
        assertEquals(1, stat.getValue());
        assertEquals(3, stat.getUpdateCount());

        Thread.sleep(500);

        stat.increment();
        assertEquals(4, stat.getUpdateCount());

        assertLastTimeNotStartTime(stat);

        LOG.info("Counter is: " + stat);

        stat.reset();

        assertEquals(0, stat.getValue());
        assertEquals(0, stat.getUpdateCount());
    }
View Full Code Here

     */
    public Statistic createStatistic(String name, Object owner, UpdateMode updateMode) {
        return updateMode == UpdateMode.COUNTER
                ? new TimeStatistic(name, null)
                : updateMode == UpdateMode.VALUE
                ? new CountStatistic(name, null)
                : null;
    }
View Full Code Here

TOP

Related Classes of org.apache.servicemix.nmr.management.stats.CountStatistic

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.