Package org.apache.commons.transaction.util

Examples of org.apache.commons.transaction.util.TurnBarrier.signalTurn()


            Thread t1 = new Thread(new Runnable() {
                public void run() {
                    try {
                        cb.waitForTurn(2);
                        manager.readLock(owner2, res2);
                        cb.signalTurn(3);
                        cb.waitForTurn(5);
                        synchronized (manager.getLock(res1)) {
                            cb.signalTurn(6);
                            manager.writeLock(owner2, res1);
                        }
View Full Code Here


                        cb.waitForTurn(2);
                        manager.readLock(owner2, res2);
                        cb.signalTurn(3);
                        cb.waitForTurn(5);
                        synchronized (manager.getLock(res1)) {
                            cb.signalTurn(6);
                            manager.writeLock(owner2, res1);
                        }
                    } catch (LockException le) {
                        assertEquals(le.getCode(), LockException.CODE_DEADLOCK_VICTIM);
                        deadlockCnt++;
View Full Code Here

                public void run() {
                    try {
                        cb.waitForTurn(3);
                        manager.readLock(owner3, res3);
                        synchronized (manager.getLock(res2)) {
                            cb.signalTurn(5);
                            manager.writeLock(owner3, res2);
                        }
                    } catch (LockException le) {
                        assertEquals(le.getCode(), LockException.CODE_DEADLOCK_VICTIM);
                        deadlockCnt++;
View Full Code Here

            t2.start();

            try {
                cb.waitForTurn(1);
                manager.readLock(owner1, res1);
                cb.signalTurn(2);
                cb.waitForTurn(6);
                manager.writeLock(owner1, res3);
            } catch (LockException le) {
                assertEquals(le.getCode(), LockException.CODE_DEADLOCK_VICTIM);
                deadlockCnt++;
View Full Code Here

            Thread t1 = new Thread(new Runnable() {
                public void run() {
                    try {
                        cb.waitForTurn(2);
                        manager.upgradeLock(owner2, res1);
                        cb.signalTurn(3);
                        cb.waitForTurn(5);
                        synchronized (manager.getLock(res1)) {
                            cb.signalTurn(6);
                            manager.writeLock(owner2, res1);
                        }
View Full Code Here

                        cb.waitForTurn(2);
                        manager.upgradeLock(owner2, res1);
                        cb.signalTurn(3);
                        cb.waitForTurn(5);
                        synchronized (manager.getLock(res1)) {
                            cb.signalTurn(6);
                            manager.writeLock(owner2, res1);
                        }
                        // we must always be first as we will be preferred over
                        // as I had the upgrade
                        // lock before
View Full Code Here

                        // next to get the lock as it is preferred over the main
                        // thread
                        // that only waits for a read lock
                        cb.waitForTurn(6);
                        synchronized (manager.getLock(res1)) {
                            cb.signalTurn(7);
                            manager.readLock(owner3, res1);
                        }
                        synchronized (this) {
                            if (first == null)
                                first = owner3;
View Full Code Here

            t2.start();

            cb.waitForTurn(1);
            manager.readLock(owner1, res1);
            cb.signalTurn(2);
            cb.waitForTurn(3);
            manager.release(owner1, res1);
            manager.readLock(owner1, res1);
            cb.signalTurn(5);
            cb.waitForTurn(7);
View Full Code Here

            manager.readLock(owner1, res1);
            cb.signalTurn(2);
            cb.waitForTurn(3);
            manager.release(owner1, res1);
            manager.readLock(owner1, res1);
            cb.signalTurn(5);
            cb.waitForTurn(7);
            synchronized (manager.getLock(res1)) {
                manager.releaseAll(owner1);
            }
            synchronized (restart) {
View Full Code Here

            Thread t1 = new Thread(new Runnable() {
                public void run() {
                    try {
                        cb.waitForTurn(2);
                        synchronized (lock) {
                            cb.signalTurn(3);
                            lock.acquire(owner2, ReadWriteLock.WRITE_LOCK, true,
                                    GenericLock.COMPATIBILITY_REENTRANT, true, TIMEOUT);
                        }
                        lock.release(owner2);
                        synchronized (restart) {
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.