Package com.hazelcast.transaction

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


            assertTrue(offered);
            context.getMap(mapName).put("lock1", "value1");
            fail();
        } catch (TransactionException ex) {
            // expected
            context.rollbackTransaction();
        }
        assertEquals(0, instances[0].getQueue(queueName).size());
        assertNull(instances[0].getMap(mapName).get("lock1"));
    }
View Full Code Here


        TransactionalQueue<String> queue = transactionContext.getQueue("testq");

        queue.offer("offered-val");

        transactionContext.rollbackTransaction();

        assertNull(h1.getQueue("testq").poll());

    }
View Full Code Here

                        if (value != null) {
                            count.incrementAndGet();
                        }
                    } catch (Exception e) {
                        try {
                            transactionContext.rollbackTransaction();
                        } catch (HazelcastInstanceNotActiveException ignored) {
                        }
                    }
                }
            }
View Full Code Here

            final String response2 = q.peek();
            assertEquals("ali", response2);
            context.commitTransaction();
        } catch (TransactionException e) {
            context.rollbackTransaction();
            throw e;
        }
        assertEquals(1, getQueue(instances, name).size());
    }
View Full Code Here

                        if (value != null) {
                            count.incrementAndGet();
                        }
                    } catch (Exception e) {
                        try {
                            transactionContext.rollbackTransaction();
                        } catch (HazelcastInstanceNotActiveException ignored) {
                        }
                    }
                }
            }
View Full Code Here

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();
        final TransactionalList<Object> list = context.getList(listName);
        list.add("item2");
        context.rollbackTransaction();

        assertEquals(1, l.size());
    }
}
View Full Code Here

            server.shutdown();

            context.commitTransaction();
            fail("commit should throw exception!!!");
        } catch (Exception e) {
            context.rollbackTransaction();
            txnRollbackLatch.countDown();
        }

        assertOpenEventually(txnRollbackLatch);
        assertOpenEventually(memberRemovedLatch);
View Full Code Here

        try {
            context.commitTransaction();
            fail("commit should throw exception !");
        } catch (Exception e) {
            context.rollbackTransaction();
            txnRollbackLatch.countDown();
        }

        assertOpenEventually(txnRollbackLatch);
        assertOpenEventually(memberRemovedLatch);
View Full Code Here

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();
        TransactionalQueue<String> qTxn = context.getQueue(name);
        qTxn.offer("ITEM");
        context.rollbackTransaction();

        assertEquals(0, queue.size());
    }

    @Test
View Full Code Here

        TransactionalQueue<String> txnQueue = context.getQueue(name);

        txnQueue.offer(item);
        assertEquals(2, txnQueue.size());

        context.rollbackTransaction();
    }


    @Test
    public void testTransactionalOfferAndPollWithTimeout() throws InterruptedException {
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.