Package org.jboss.cache.transaction

Examples of org.jboss.cache.transaction.DummyTransactionManager.commit()


        // first put in a value
        mgr.begin();
        assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
        assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
        cache.put("/one/two", "key1", "val1");
        mgr.commit();
        keys = cache.getKeys("/one/two");
        System.out.println("keys after TX #1: " + keys);
        assertEquals(1, keys.size());

        // First TX
View Full Code Here


        mgr.suspend();

        // Second TX
        mgr.begin();
        cache.put("/one/two", "key3", "val3");
        mgr.commit(); // now version is 2, attrs are key1 and key3

        // assert we can see this outside the existing tx
        keys = cache.getKeys("/one/two");
        System.out.println("keys after TX #3 committed: " + keys);
        assertEquals(2, keys.size());
View Full Code Here

        assertEquals(2, keys.size()); // we will see key1 and key2, but *not* key3

        // this will fail as our workspace has version 1, whereas cache has 2; TX will be rolled back
        try
        {
            mgr.commit();
            fail("TX should fail as other TX incremented version number");
        }
        catch (RollbackException rollback_ex)
        {
            System.out.println("TX was rolled back because the other TX committed first and incremented version ID." +
View Full Code Here

        tx = mgr.getTransaction();
        mgr.suspend();

        mgr.begin();
        Assert.assertNull(cache.get(fqn, key));
        mgr.commit();

        mgr.resume(tx);
        Assert.assertEquals(value, cache.get(fqn, key));
        mgr.commit();
View Full Code Here

        Assert.assertNull(cache.get(fqn, key));
        mgr.commit();

        mgr.resume(tx);
        Assert.assertEquals(value, cache.get(fqn, key));
        mgr.commit();

        Assert.assertEquals(value, cache.get(fqn, key));

    }
View Full Code Here

        tx = mgr.getTransaction();
        mgr.suspend();

        mgr.begin();
        Assert.assertEquals(value, cache.get(fqn, key));
        mgr.commit();

        mgr.resume(tx);
        Assert.assertNull(cache.get(fqn));
        mgr.commit();
View Full Code Here

        Assert.assertEquals(value, cache.get(fqn, key));
        mgr.commit();

        mgr.resume(tx);
        Assert.assertNull(cache.get(fqn));
        mgr.commit();

        Assert.assertNull(cache.get(fqn));
    }

View Full Code Here

        tx = mgr.getTransaction();
        mgr.suspend();

        mgr.begin();
        Assert.assertEquals(value, cache.get(fqn, key));
        mgr.commit();

        mgr.resume(tx);
        Assert.assertNull(cache.get(fqn));
        mgr.commit();
View Full Code Here

        Assert.assertEquals(value, cache.get(fqn, key));
        mgr.commit();

        mgr.resume(tx);
        Assert.assertNull(cache.get(fqn));
        mgr.commit();

        Assert.assertNull(cache.get(fqn));
    }

    public void testLoopedPutAndGet() throws Exception
View Full Code Here

                for (int j = 0; j < numPuts; j++)
                {
                    cache1.put(Fqn.fromString("/profiler/node" + i), "key" + j, "value" + j);
                }
                log.debug("*** >> Out of put loop");
                mgr.commit();
                //cache2.get(Fqn.fromString("/profiler/node" + i));
            }

            destroyCache(cache1);
            destroyCache(cache2);
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.