Package com.hazelcast.core

Examples of com.hazelcast.core.IAtomicLong


        assertEquals(11, ref.get());
    }

    @Test(expected = IllegalArgumentException.class)
    public void getAndAlter_whenCalledWithNullFunction() {
        IAtomicLong ref = client.getAtomicLong("getAndAlter_whenCalledWithNullFunction");

        ref.getAndAlter(null);
    }
View Full Code Here


        ref.getAndAlter(null);
    }

    @Test
    public void getAndAlter_whenException() {
        IAtomicLong ref = client.getAtomicLong("getAndAlter_whenException");
        ref.set(10);

        try {
            ref.getAndAlter(new FailingFunction());
            fail();
        } catch (WoohaaException expected) {
        }

        assertEquals(10, ref.get());
    }
View Full Code Here

        assertEquals(10, ref.get());
    }

    @Test
    public void getAndAlter() {
        IAtomicLong ref = client.getAtomicLong("getAndAlter");

        ref.set(10);
        assertEquals(10, ref.getAndAlter(new AddOneFunction()));
        assertEquals(11, ref.get());
    }
View Full Code Here

        register(MapReduceService.SERVICE_NAME, ClientMapReduceProxy.class);
        register(ReplicatedMapService.SERVICE_NAME, ClientReplicatedMapProxy.class);

        register(IdGeneratorService.SERVICE_NAME, new ClientProxyFactory() {
            public ClientProxy create(String id) {
                IAtomicLong atomicLong = client.getAtomicLong(IdGeneratorService.ATOMIC_LONG_NAME + id);
                return new ClientIdGeneratorProxy(IdGeneratorService.SERVICE_NAME, id, atomicLong);
            }
        });

        for (ProxyFactoryConfig proxyFactoryConfig : config.getProxyFactoryConfigs()) {
View Full Code Here

        @Override
        public void doRun() throws Exception {
            while (!isStopped()) {
                int key = random.nextInt(REFERENCE_COUNT);
                IAtomicLong reference = references[key];
                long value = reference.get();
                assertEquals(format("The value for atomic reference: %s was not consistent", reference), key, value);
            }
        }
View Full Code Here

        public void doRun() throws Exception {
            while (!isStopped()) {
                int index = random.nextInt(REFERENCE_COUNT);
                int increment = random.nextInt(100);
                increments[index] += increment;
                IAtomicLong reference = references[index];
                reference.addAndGet(increment);
            }
        }
View Full Code Here

TOP

Related Classes of com.hazelcast.core.IAtomicLong

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.