Package java.util.concurrent.locks

Examples of java.util.concurrent.locks.Condition.await()


        }   
      }
    }).start();
    try {
      lock.lock();
      condition.await(timeout, timeoutUnit);
    } catch (InterruptedException ie) {
      Thread.currentThread().interrupt();
    } finally {
      lock.unlock();
    }
View Full Code Here


        boolean await = latch.await(3, TimeUnit.SECONDS);
        assertEquals(true, await);
        boolean success = false;
        lock.lock();
        try {
            success = signal.await(3, TimeUnit.SECONDS);
        } finally {
            lock.unlock();
        }
        assertEquals(true, success);
        assertEquals(10, topologyFromZK.getTopology().getNodes().size());
View Full Code Here

       
        workqueue.schedule(doNothing, 5000);
       
        runLock.lock();
        try {
            runCondition.await();
        } finally {
            runLock.unlock();
        }
       
        assertTrue("expected delay",
View Full Code Here

       
        workqueue.schedule(doNothing, 5000);
       
        runLock.lock();
        try {
            runCondition.await();
        } finally {
            runLock.unlock();
        }
       
        assertTrue("expected delay",
View Full Code Here

            // while keeping the wait-for-flush (future.get) out of anything latency-sensitive.
            return postFlushExecutor.submit(new WrappedRunnable()
            {
                public void runMayThrow() throws InterruptedException, IOException
                {
                    condition.await();
                    if (writeCommitLog)
                    {
                        // if we're not writing to the commit log, we are replaying the log, so marking
                        // the log header with "you can discard anything written before the context" is not valid
                        CommitLog.instance().discardCompletedSegments(table_, columnFamily_, ctx);
View Full Code Here

                    if (deadline > 0) {
                        final long now = System.nanoTime();
                        if (now > deadline)
                            return null; // throw new java.util.concurrent.TimeoutException();
                        cond.await(deadline - now, TimeUnit.NANOSECONDS);
                    } else
                        cond.await();
                    buf = store.get(root);
                }
            } finally {
View Full Code Here

                        final long now = System.nanoTime();
                        if (now > deadline)
                            return null; // throw new java.util.concurrent.TimeoutException();
                        cond.await(deadline - now, TimeUnit.NANOSECONDS);
                    } else
                        cond.await();
                    buf = store.get(root);
                }
            } finally {
                lck0.unlock();
            }
View Full Code Here

                this.waiters.addLast(moreMemory);
                // loop over and over until we have a buffer or have reserved
                // enough memory to allocate one
                while (accumulated < size) {
                    long startWait = time.nanoseconds();
                    moreMemory.await();
                    long endWait = time.nanoseconds();
                    this.waitTime.record(endWait - startWait, time.milliseconds());

                    // check if we can satisfy this request from the free list,
                    // otherwise allocate memory
View Full Code Here

        }.start();


        try {
            lock.lock();
            condition.await();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        } finally {
            lock.unlock();
        }
View Full Code Here

        lock.lock();
        try {
            addIQListener(listener);
            send(stanza);
            // Wait for the stanza to arrive.
            if (!resultReceived.await(timeout, TimeUnit.MILLISECONDS)) {
                throw new NoResponseException("Timeout reached, while waiting on a response.");
            }
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        } finally {
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.