Examples of waitForTurn()


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

            jamThread2.start();

            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);
View Full Code Here

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

                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);
                        }
                    } catch (LockException le) {
View Full Code Here

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

            t1.start();

            Thread t2 = new Thread(new Runnable() {
                public void run() {
                    try {
                        cb.waitForTurn(3);
                        manager.readLock(owner3, res3);
                        synchronized (manager.getLock(res2)) {
                            cb.signalTurn(5);
                            manager.writeLock(owner3, res2);
                        }
View Full Code Here

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

            }, "Thread #2");

            t2.start();

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

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

            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++;
            } catch (InterruptedException ie) {
View Full Code Here

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

            System.out.print(".");

            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);
View Full Code Here

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

                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);
                        }
                        // we must always be first as we will be preferred over
View Full Code Here

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

                        // when I release my single read lock, thread #1 always
                        // should be the
                        // 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) {
View Full Code Here

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

                }
            }, "Thread #2");

            t2.start();

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

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

            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);
            synchronized (manager.getLock(res1)) {
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.