Examples of lockInterruptibly()


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

      if (lock == null)
         throw new ResourceException(bundle.unableObtainLock());

      try
      {
         lock.lockInterruptibly();
      }
      catch (InterruptedException ie)
      {
         Thread.interrupted();
        
View Full Code Here

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

         throw new ResourceException(bundle.unableObtainLock());
      }

      try
      {
         lock.lockInterruptibly();
      }
      catch (InterruptedException ie)
      {
         Thread.interrupted();
View Full Code Here

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

  {
    if (!this.isAlive(database, Level.DEBUG)) return false;
   
    Lock lock = this.lockManager.writeLock(null);
   
    lock.lockInterruptibly();
   
    try
    {
      if (this.balancer.contains(database)) return false;
     
View Full Code Here

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

    if (guard.monitor != this) {
      throw new IllegalMonitorStateException();
    }
    final ReentrantLock lock = this.lock;
    boolean reentrant = lock.isHeldByCurrentThread();
    lock.lockInterruptibly();
    try {
      waitInterruptibly(guard, reentrant);
    } catch (Throwable throwable) {
      lock.unlock();
      throw Throwables.propagate(throwable);
View Full Code Here

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

  public boolean enterIfInterruptibly(Guard guard) throws InterruptedException {
    if (guard.monitor != this) {
      throw new IllegalMonitorStateException();
    }
    final ReentrantLock lock = this.lock;
    lock.lockInterruptibly();
    boolean satisfied;
    try {
      satisfied = guard.isSatisfied();
    } catch (Throwable throwable) {
      lock.unlock();
View Full Code Here

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

     */
    public void put(E e) throws InterruptedException {
        Importance i = (Importance) e;
        InternalQueue<E> internalQueue = getQueueForPriority(i.getPriority());
        final ReentrantLock lock = this.lock;
        lock.lockInterruptibly();
        try {
            try {
                while (internalQueue.remainingCapacity() == 0) {
                    internalQueue.getNotFullCond().await();
                }
View Full Code Here

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

        Importance i = (Importance) e;
        InternalQueue<E> internalQueue = getQueueForPriority(i.getPriority());

        long nanos = unit.toNanos(timeout);
        final ReentrantLock lock = this.lock;
        lock.lockInterruptibly();
        try {
            for (;;) {
                if (internalQueue.remainingCapacity() > 0) {
                    internalQueue.offer(e);
                    count++;
View Full Code Here

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

     * @return an element
     * @throws InterruptedException if the thread is interrupted
     */
    public E take() throws InterruptedException {
        final ReentrantLock lock = this.lock;
        lock.lockInterruptibly();
        try {
            InternalQueue<E> internalQueue = nextQueueAlgorithm.getNextQueue();
            try {
                while (internalQueue == null) {
                    notEmpty.await();
View Full Code Here

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

     * @throws InterruptedException
     */
    public E poll(long timeout, TimeUnit unit) throws InterruptedException {
        long nanos = unit.toNanos(timeout);
        final ReentrantLock lock = this.lock;
        lock.lockInterruptibly();
        try {
            for (;;) {
                InternalQueue<E> internalQueue = nextQueueAlgorithm.getNextQueue();
                if (internalQueue != null) {
                    E e = internalQueue.poll();
View Full Code Here

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

                                    }
                                }

                                log("Thread started, waiting for interruption");
                                try {
                                    interruptLock.lockInterruptibly();
                                } catch (InterruptedException e) {
                                    log("I was interrupted");
                                }
                            }
                        });
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.