Package org.apache.ojb.odmg.locking

Examples of org.apache.ojb.odmg.locking.LockManager.writeLock()


                }
            }
            else if (lockMode == Transaction.WRITE)
            {
                if (log.isDebugEnabled()) log.debug("Do WRITE lock on object: " + oid);
                if(!lm.writeLock(this, oid, obj))
                {
                    throw new LockNotGrantedException("Can not lock for WRITE: " + oid);
                }
            }
            else if (lockMode == Transaction.UPGRADE)
View Full Code Here


        a.setArticleId(333);

        tx1.begin();
        tx2.begin();
        LockManager lm = LockManagerFactory.getLockManager();
        boolean success1 = lm.writeLock(tx1, a);
        boolean success2 = lm.writeLock(tx2, a);

        boolean success3 = lm.releaseLock(tx1, a);

        assertTrue("1st lock should succeed", success1);
View Full Code Here

        tx1.begin();
        tx2.begin();
        LockManager lm = LockManagerFactory.getLockManager();
        boolean success1 = lm.writeLock(tx1, a);
        boolean success2 = lm.writeLock(tx2, a);

        boolean success3 = lm.releaseLock(tx1, a);

        assertTrue("1st lock should succeed", success1);
        assertTrue("2nd lock should not succeed", !success2);
View Full Code Here

        tx2.begin();
        LockManager lm = LockManagerFactory.getLockManager();

        assertFalse(tx1.getGUID().equals(tx2.getGUID()));

        assertTrue("1st lock should succeed", lm.writeLock(tx1, a1));
        assertFalse("2nd lock should not succeed", lm.writeLock(tx2, a2));
        lm.releaseLock(tx2, a2);
        lm.releaseLock(tx2, a1);
        assertFalse(lm.checkWrite(tx2, a1));
        assertFalse(lm.checkWrite(tx2, a2));
View Full Code Here

        LockManager lm = LockManagerFactory.getLockManager();

        assertFalse(tx1.getGUID().equals(tx2.getGUID()));

        assertTrue("1st lock should succeed", lm.writeLock(tx1, a1));
        assertFalse("2nd lock should not succeed", lm.writeLock(tx2, a2));
        lm.releaseLock(tx2, a2);
        lm.releaseLock(tx2, a1);
        assertFalse(lm.checkWrite(tx2, a1));
        assertFalse(lm.checkWrite(tx2, a2));
        assertTrue(lm.checkWrite(tx1, a1));
View Full Code Here

        assertTrue(lm.checkWrite(tx1, a1));
        assertTrue(lm.checkWrite(tx1, a2));
        //assertFalse("2nd release should not succeed", lm.releaseLock(tx2, a2));
        //assertFalse("2nd release should not succeed", lm.releaseLock(tx2, a1));
        assertTrue("release should succeed", lm.releaseLock(tx1, a2));
        assertTrue("2nd object lock should succeed", lm.writeLock(tx2, a2));
        assertTrue("release 2nd object lock should succeed", lm.releaseLock(tx2, a2));

        try
        {
            tx1.abort();
View Full Code Here

        for (int i = 0; i < arr.length; i++)
        {
            tx.lock(arr[i], Transaction.WRITE);
        }
        LockManager lm = LockManagerFactory.getLockManager();
        boolean success = lm.writeLock(tx, arr[(loops - 2)]);
        assertTrue("lock should succeed", success);
        tx.commit();

        TransactionImpl tx2 = (TransactionImpl) odmg2.newTransaction();
        tx2.begin();
View Full Code Here

        assertTrue("lock should succeed", success);
        tx.commit();

        TransactionImpl tx2 = (TransactionImpl) odmg2.newTransaction();
        tx2.begin();
        success = lm.writeLock(tx2, arr[(loops - 2)]);
        assertTrue("lock should succeed", success);

        OQLQuery query = odmg2.newOQLQuery();
        String sql = "select allArticles from " + Article.class.getName() +
                " where articleName = \"" + PRE + "testLockLoop" + "\"";
View Full Code Here

        a.setArticleId(333);

        tx1.begin();
        tx2.begin();
        LockManager lm = LockManagerFactory.getLockManager();
        boolean success1 = lm.writeLock(tx1, a);
        boolean success2 = lm.writeLock(tx2, a);

        boolean success3 = lm.releaseLock(tx1, a);

        assertTrue("1st lock should succeed", success1);
View Full Code Here

        tx1.begin();
        tx2.begin();
        LockManager lm = LockManagerFactory.getLockManager();
        boolean success1 = lm.writeLock(tx1, a);
        boolean success2 = lm.writeLock(tx2, a);

        boolean success3 = lm.releaseLock(tx1, a);

        assertTrue("1st lock should succeed", success1);
        assertTrue("2nd lock should not succeed", !success2);
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.