Package com.hazelcast.transaction

Examples of com.hazelcast.transaction.TransactionContext.beginTransaction()


        final String key = "key";
        final String value = "Value";
        final IMap map = client.getMap(mapName);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();
        final TransactionalMap<Object, Object> txnMap = context.getMap(mapName);
        txnMap.put(key, value);
        context.commitTransaction();

        assertEquals(value, map.get(key));
View Full Code Here


        final String key = "key";
        final String value = "Value";
        final IMap map = client.getMap(mapName);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();
        final TransactionalMap<Object, Object> txnMap = context.getMap(mapName);

        assertNull(txnMap.put(key, value));

        context.commitTransaction();
View Full Code Here

        final String key = "key";
        final String value = "Value";
        final IMap map = client.getMap(mapName);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();
        final TransactionalMap<Object, Object> txnMap = context.getMap(mapName);

        txnMap.put(key, value);
        assertEquals(value, txnMap.get(key));
        assertNull(map.get(key));
View Full Code Here

        final String key = "key";
        final String value = "Value";
        final IMap map = client.getMap(mapName);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();
        final TransactionalMap<Object, Object> txnMap = context.getMap(mapName);

        txnMap.put(key, value, ttlSeconds, TimeUnit.SECONDS);
        Object resultFromClientWhileTxnInProgress = map.get(key);
View Full Code Here

        final String mapName = randomString();
        IMap map = client.getMap(mapName);
        map.put("key1", "value1");

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();
        final TransactionalMap<Object, Object> txMap = context.getMap(mapName);

        assertNull(txMap.put("key2", "value2"));
        assertEquals(2, txMap.size());
        assertEquals(2, txMap.keySet().size());
View Full Code Here

        final SampleObjects.Employee emp2 = new SampleObjects.Employee("abc-123-xvz", 20, true, 10D);

        map.put(emp1, emp1);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();
        final TransactionalMap txMap = context.getMap(mapName);

        assertNull(txMap.put(emp2, emp2));
        assertEquals(2, txMap.size());
        assertEquals(2, txMap.keySet().size());
View Full Code Here

        final String key = "key";
        final String value = "value";
        final IMap map = client.getMap(mapName);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();
        final TransactionalMap<Object, Object> mapTxn = context.getMap(mapName);
        mapTxn.put(key, value);
        context.rollbackTransaction();

        assertNull(map.get(key));
View Full Code Here

        final String mapName = randomString();
        IMap map = client.getMap(mapName);
        map.put("key1", "value1");

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();
        final TransactionalMap txMap = context.getMap(mapName);
        txMap.put("key2", "value2");
        assertTrue(txMap.containsKey("key1"));
        assertTrue(txMap.containsKey("key2"));
        assertFalse(txMap.containsKey("key3"));
View Full Code Here

    public void testTnxMapIsEmpty() throws Exception {
        final String mapName = randomString();
        IMap map = client.getMap(mapName);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();
        final TransactionalMap txMap = context.getMap(mapName);
        assertTrue(txMap.isEmpty());
        context.commitTransaction();
    }
View Full Code Here

        final String keyValue1 = "keyValue1";
        final String keyValue2 = "keyValue2";
        map.put(keyValue1, keyValue1);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();
        final TransactionalMap txMap = context.getMap(mapName);

        txMap.putIfAbsent(keyValue1, "NOT_THIS");
        txMap.putIfAbsent(keyValue2, keyValue2);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.