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.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.