Package com.hazelcast.transaction

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


        public void run() {
            while (!isInterrupted()) {
                TransactionContext tx = hz.newTransactionContext();
                try {
                    tx.beginTransaction();
                    String id = UUID.randomUUID().toString();
                    TransactionalQueue<String> q = tx.getQueue(name);
                    q.offer(id);
                    DummyTransactionalObject slowTxObject = tx.getTransactionalObject(dummyServiceName, name);
                    slowTxObject.doSomethingTxnal();
View Full Code Here


        final CountDownLatch latch = new CountDownLatch(1);
        final Thread t = new Thread() {
            @Override
            public void run() {
                TransactionContext ctx = instance2.newTransactionContext();
                ctx.beginTransaction();
                TransactionalMap<Integer, Integer> txnMap = ctx.getMap("test");
                latch.countDown();
                txnMap.delete(1);
                ctx.commitTransaction();
            }
View Full Code Here

        final String element = "item1";
        final String setName = randomString();
        final ISet set = client.getSet(setName);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();

        final TransactionalSet<Object> txnSet = context.getSet(setName);
        assertTrue(txnSet.add(element));
        assertEquals(1, txnSet.size());
View Full Code Here

        final String element = "item1";
        final String setName = randomString();
        final ISet set = client.getSet(setName);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();

        final TransactionalSet<Object> txnSet = context.getSet(setName);
        txnSet.add(element);

        context.commitTransaction();
View Full Code Here

        final String setName = randomString();
        final ISet set = client.getSet(setName);
        set.add(element);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();

        final TransactionalSet<Object> txnSet = context.getSet(setName);
        assertTrue(txnSet.remove(element));
        assertFalse(txnSet.remove("NOT_THERE"));
View Full Code Here

        final String setName = randomString();
        final ISet set = client.getSet(setName);
        set.add(element);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();

        final TransactionalSet<Object> txnSet = context.getSet(setName);
        txnSet.remove(element);

        context.commitTransaction();
View Full Code Here

    public void testAddDuplicateElement_withinTxn() throws Exception {
        final String element = "item1";
        final String setName = randomString();

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();

        final TransactionalSet<Object> txnSet = context.getSet(setName);
        assertTrue(txnSet.add(element));
        assertFalse(txnSet.add(element));
        context.commitTransaction();
View Full Code Here

        final String setName = randomString();
        final ISet set = client.getSet(setName);
        set.add(element);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();

        final TransactionalSet<Object> txnSet = context.getSet(setName);
        assertFalse(txnSet.add(element));

        context.commitTransaction();
View Full Code Here

        final String setName = randomString();
        final ISet set = client.getSet(setName);
        set.add(element);

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();

        final TransactionalSet<Object> txnSet = context.getSet(setName);
        txnSet.add(element);
        context.commitTransaction();
View Full Code Here

        final ISet set = client.getSet(setName);

        set.add("item1");

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();
        final TransactionalSet<Object> setTxn = context.getSet(setName);
        setTxn.add("item2");
        context.rollbackTransaction();

        assertEquals(1, set.size());
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.