Package java.util.concurrent.locks

Examples of java.util.concurrent.locks.Lock.lockInterruptibly()


                Lock readLock = rwLock.readLock();
                //wait for other thread to be ready
                barrier.await();
                //now attempt to lock interruptibly
                try{
                    readLock.lockInterruptibly();
                }catch(InterruptedException ie){
                    //we were successfully interrupted
                    return true;
                }
                return false;
View Full Code Here


        assertTrue("lock not acquired!",acquired);
        Future<Void> writeFuture = testService.submit(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
                Lock writeLock = rwLock.writeLock();
                writeLock.lockInterruptibly();
                try{
                    return null;
                }finally {
                    writeLock.unlock();
                }
View Full Code Here

        assertTrue("lock not acquired!",acquired);
        Future<Void> writeFuture = testService.submit(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
                Lock writeLock = rwLock.writeLock();
                writeLock.lockInterruptibly();
                try{
                    return null;
                }finally {
                    writeLock.unlock();
                }
View Full Code Here

    private Thread leader = null;


    public FetchRequest take() throws InterruptedException {
        final Lock lock = this.lock;
        lock.lockInterruptibly();
        try {
            for (;;) {
                FetchRequest first = this.queue.peek();
                if (first == null) {
                    this.available.await();
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.