Package java.util.concurrent.locks

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


            if (isClosing)
                newPool.closeAsync();

            return true;
        } finally {
            l.unlock();
        }
    }

    // Returns whether there was problem creating the pool
    ListenableFuture<Boolean> maybeAddPool(final Host host, ListeningExecutorService executor) {
View Full Code Here


          this.handleTransactionFailure(txn);
          Throwables.propagate(ex);
        }
      }
    } finally {
      lock.unlock();
    }

    if (isCoalesceTest) {
      totalCallbacksReceived += callbacksReceived.get();
    }
View Full Code Here

        filter.position(0);
        forkedFilter.close();
        forkedFilter = null;
      } finally {
        forkedLock.unlock();
      }
    } finally {
      lock.writeLock().unlock();
    }
  }
View Full Code Here

          }
         
          Lock rl = rwl.writeLock();
          rl.lock();
          atom.incrementAndGet();
          rl.unlock();
         
          Lock wl = rwl.readLock();
          wl.lock();
          System.out.println("threadId "+threadId +"lockOblect state "+atom.get());
         
View Full Code Here

         
          Lock wl = rwl.readLock();
          wl.lock();
          System.out.println("threadId "+threadId +"lockOblect state "+atom.get());
         
          wl.unlock();
          threadId++;
         
            }
        }).start();
View Full Code Here

        try {
            processExchange(exchange, target);
        } finally {
            // do not remove as the locks cache has an upper bound
            // this ensure the locks is appropriate reused
            lock.unlock();
            // and remove the write file name header as we only want to use it once (by design)
            exchange.getIn().removeHeader(Exchange.OVERRULE_FILE_NAME);
            // and restore existing file name
            exchange.getIn().setHeader(Exchange.FILE_NAME, existing);
        }
View Full Code Here

        condition.await(100, TimeUnit.MILLISECONDS);
      }
      // Give the tracker a bit more time to finish:
      condition.await(100, TimeUnit.MILLISECONDS);
    } finally {
      lock.unlock();
    }
    tracker.setEnabled(false);

    // Check the result:
    assertEquals(1, tracker.getData().size());
View Full Code Here

          || !listener.getLaunch(configName2).isTerminated()) {
        condition.await(100, TimeUnit.MILLISECONDS);
      }
      condition.await(100, TimeUnit.MILLISECONDS);
    } finally {
      lock.unlock();
    }
    tracker.setEnabled(false);

    assertEquals(2, tracker.getData().size());
    LaunchEvent event1 = null;
View Full Code Here

        condition.await(100, TimeUnit.MILLISECONDS);
      }
      suspendResume[0].resume();
      condition.await(500, TimeUnit.MILLISECONDS);
    } finally {
      lock.unlock();
    }

    assertEquals(1, tracker.getData().size());
    LaunchEvent event = tracker.getData().iterator().next();
    assertEquals(2, event.getFilePaths().size());
View Full Code Here

        if (collection == Collection.NODES) {
            Lock lock = getAndLock(key);
            try {
                nodesCache.invalidate(key);
            } finally {
                lock.unlock();
            }
        }
    }

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