Package org.openspaces.bigdata.processor.events

Examples of org.openspaces.bigdata.processor.events.TokenCounter


        return receiveHandler;
    }

    @EventTemplate
    TokenCounter tokenCounter() {
        return new TokenCounter();
    }
View Full Code Here


        log.info("writing " + tokenMap.size() + " TokenCounters across the cluster");
        for (Entry<String, Integer> entry : tokenMap.entrySet()) {
            String token = entry.getKey();
            Integer counter = entry.getValue();
            log.fine("writing new TokenCounter: token=" + token + ", counter=" + counter);
            clusteredGigaSpace.write(new TokenCounter(token, counter), LEASE_TTL, WRITE_TIMEOUT, WriteModifiers.UPDATE_OR_WRITE);
        }
    }
View Full Code Here

        gigaSpace.clear(null);
    }

    @Test
    public void saveTwoCountersAndRequestAll() {
        TokenCounter foo = new TokenCounter("foo", 3);
        TokenCounter bar = new TokenCounter("bar", 8);

        gigaSpace.write(foo);
        gigaSpace.write(bar);

        TokenCounter requestAll = new TokenCounter();

        assertThat(gigaSpace.readMultiple(requestAll)) //
                .isNotNull() //
                .hasSize(2) //
                .contains(foo) //
View Full Code Here

                .contains(bar);
    }

    @Test
    public void saveTwoCountersButRequestOnlyFoo() {
        TokenCounter foo = new TokenCounter("foo", 3);
        TokenCounter bar = new TokenCounter("bar", 8);

        gigaSpace.write(foo);
        gigaSpace.write(bar);

        TokenCounter requestFoo = new TokenCounter("foo");

        assertThat(gigaSpace.readMultiple(requestFoo)) //
                .isNotNull() //
                .hasSize(1) //
                .containsOnly(foo);
View Full Code Here

TOP

Related Classes of org.openspaces.bigdata.processor.events.TokenCounter

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.