Package org.apache.commons.transaction.util

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


            Thread t2 = new Thread(new Runnable() {
                public void run() {
                    try {
                        cb.waitForTurn(3);
                        synchronized (lock) {
                            cb.signalTurn(4);
                            lock.acquire(owner3, ReadWriteLock.WRITE_LOCK, true,
                                    GenericLock.COMPATIBILITY_REENTRANT, true, TIMEOUT);
                        }
                        lock.release(owner3);
                        synchronized (restart) {
View Full Code Here


            t2.start();

            cb.waitForTurn(1);
            lock.acquireRead(owner1, TIMEOUT);
            cb.signalTurn(2);
            cb.waitForTurn(4);
            synchronized (lock) {
                lock.release(owner1);
            }
            synchronized (restart) {
View Full Code Here

            Thread t1 = new Thread(new Runnable() {
                public void run() {
                    try {
                        cb.waitForTurn(2);
                        manager.lock(owner2, res1, 1, true);
                        cb.signalTurn(3);
                        manager.releaseAll(owner2);
                        synchronized (restart) {
                            restart.meet();
                            restart.reset();
                        }
View Full Code Here

            t1.start();

            cb.waitForTurn(1);
            manager.startGlobalTimeout(owner1, 500);
            manager.lock(owner1, res1, 1, true);
            cb.signalTurn(2);
            cb.waitForTurn(3);
            boolean failed = false;
            try {
                manager.tryLock(owner1, res1, 1, true);
            } catch (LockException le) {
View Full Code Here

            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

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.