Package com.hazelcast.core

Examples of com.hazelcast.core.TransactionalMultiMap


        final MultiMap<Object, Object> mm = instance.getMultiMap("testMultiMapContainsEntry");
        mm.put("1", "value");
        assertTrue(mm.containsEntry("1", "value"));

        context.beginTransaction();
        TransactionalMultiMap txnMap = context.getMultiMap("testMultiMapContainsEntry");
        txnMap.put("1", "value2");
        assertTrue(mm.containsEntry("1", "value"));
        assertFalse(mm.containsEntry("1", "value2"));
        txnMap.remove("1", "value2");
        assertTrue(mm.containsEntry("1", "value"));
        assertFalse(mm.containsEntry("1", "value2"));
        context.commitTransaction();

        assertTrue(mm.containsEntry("1", "value"));
View Full Code Here


        multiMap.put("2", "x");
        multiMap.put("2", "y");

        final TransactionContext context = instance.newTransactionContext();
        context.beginTransaction();
        TransactionalMultiMap txnMap = context.getMultiMap("testMultiMapPutRemoveWithTxn");
        txnMap.put("1", "A");
        txnMap.put("1", "B");
        Collection g1 = txnMap.get("1");
        assertTrue(g1.contains("A"));
        assertTrue(g1.contains("B"));
        assertTrue(g1.contains("C"));
        assertTrue(txnMap.remove("1", "C"));
        assertEquals(4, txnMap.size());
        Collection g2 = txnMap.get("1");
        assertTrue(g2.contains("A"));
        assertTrue(g2.contains("B"));
        assertFalse(g2.contains("C"));
        Collection r1 = txnMap.remove("2");
        assertTrue(r1.contains("x"));
        assertTrue(r1.contains("y"));
        assertEquals(0, txnMap.get("2").size());
        Collection r2 = txnMap.remove("1");
        assertEquals(2, r2.size());
        assertTrue(r2.contains("A"));
        assertTrue(r2.contains("B"));
        assertEquals(0, txnMap.get("1").size());
        assertEquals(0, txnMap.size());
        assertEquals(3, multiMap.size());
        context.commitTransaction();
        assertEquals(0, multiMap.size());
    }
View Full Code Here

        multiMap.put(key, val);

        TransactionContext tx = client.newTransactionContext();
        tx.beginTransaction();

        TransactionalMultiMap txnMultiMap = tx.getMultiMap(mapName);
        txnMultiMap.remove(key, val);

        tx.commitTransaction();

        assertEquals(Collections.EMPTY_SET, client.getMultiMap(mapName).get(key));
    }
View Full Code Here

        }

        TransactionContext tx = client.newTransactionContext();
        tx.beginTransaction();

        TransactionalMultiMap txnMultiMap = tx.getMultiMap(mapName);
        txnMultiMap.remove(key);
        tx.commitTransaction();

        assertEquals(Collections.EMPTY_SET, multiMap.get(key));
    }
View Full Code Here

                    multiMap.put(key, "value");

                    final TransactionContext context = client.newTransactionContext();
                    try {
                        context.beginTransaction();
                        final TransactionalMultiMap txnMultiMap = context.getMultiMap(mapName);
                        txnMultiMap.put(key, "value");
                        txnMultiMap.put(key, "value1");
                        txnMultiMap.put(key, "value2");
                        assertEquals(3, txnMultiMap.get(key).size());
                        context.commitTransaction();

                        assertEquals(3, multiMap.get(key).size());
                    } catch (Exception e) {
                        error.compareAndSet(null, e);
View Full Code Here

        final String value = "value";
        final MultiMap multiMap = client.getMultiMap(mapName);

        TransactionContext tx = client.newTransactionContext();
        tx.beginTransaction();
        TransactionalMultiMap mulitMapTxn = tx.getMultiMap(mapName);
        mulitMapTxn.put(key, value);
        mulitMapTxn.put(key, value);
        tx.rollbackTransaction();

        assertEquals(Collections.EMPTY_SET, multiMap.get(key));
    }
View Full Code Here

        multiMap.put(key, value);

        TransactionContext tx = client.newTransactionContext();
        tx.beginTransaction();
        TransactionalMultiMap mulitMapTxn = tx.getMultiMap(mapName);
        mulitMapTxn.put(key, "newValue");
        mulitMapTxn.put("newKey", value);
        assertEquals(3, mulitMapTxn.size());

        tx.commitTransaction();
    }
View Full Code Here

        multiMap.put(key, value);

        TransactionContext tx = client.newTransactionContext();
        tx.beginTransaction();
        TransactionalMultiMap mulitMapTxn = tx.getMultiMap(mapName);
        mulitMapTxn.put(key, "newValue");

        assertEquals(2, mulitMapTxn.valueCount(key));

        tx.commitTransaction();
    }
View Full Code Here

        multiMap.put(key, value);

        TransactionContext tx = client.newTransactionContext();
        tx.beginTransaction();
        TransactionalMultiMap mulitMapTxn = tx.getMultiMap(mapName);
        Collection c = mulitMapTxn.get(key);
        assertFalse(c.isEmpty());
        tx.commitTransaction();
    }
View Full Code Here

        multiMap.put(key, value);

        TransactionContext tx = client.newTransactionContext();
        tx.beginTransaction();
        TransactionalMultiMap mulitMapTxn = tx.getMultiMap(mapName);
        Collection c = mulitMapTxn.remove(key);
        assertFalse(c.isEmpty());
        tx.commitTransaction();
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.core.TransactionalMultiMap

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.