Package org.apache.sirona.store.counter

Examples of org.apache.sirona.store.counter.BatchCounterDataStore


    }

    @Test
    public void clear() throws InterruptedException {
        final LinkedList<Integer> size = new LinkedList<Integer>();
        final BatchCounterDataStore store = new BatchCounterDataStore() {
            @Override
            protected void pushCountersByBatch(final Collection<Counter> instance) {
                size.add(instance.size());
            }

            @Override
            protected int getPeriod(final String prefix) {
                return 100;
            }

            @Override
            protected boolean isClearAfterCollect(final String prefix) {
                return true;
            }
        };

        Repository.INSTANCE.getCounter(new Counter.Key(Role.PERFORMANCES, "counter")).add(123);
        Thread.sleep(250);
        store.shutdown();

        assertTrue(size.size() >= 2);
        assertEquals(1, size.iterator().next().intValue());
        assertEquals(0, size.get(1).intValue());
    }
View Full Code Here

TOP

Related Classes of org.apache.sirona.store.counter.BatchCounterDataStore

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.