Package java.util.concurrent.locks

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


            // manager and cach all dictionaries whose service.pid is set
            if ( !fullyLoaded )
            {
                lock.unlock();
                lock = globalLock.writeLock();
                lock.lock();
                if ( !fullyLoaded )
                {
                    Enumeration fromPm = pm.getDictionaries();
                    while (fromPm.hasMoreElements())
                    {
View Full Code Here


     */
    public Dictionary load( String pid ) throws IOException
    {
        Lock lock = globalLock.readLock();
        try {
            lock.lock();
            Dictionary loaded = ( Dictionary ) cache.get( pid );
            if ( loaded == null && !fullyLoaded )
            {
                lock.unlock();
                lock = globalLock.writeLock();
View Full Code Here

    private boolean replacePool(Host host, HostDistance distance, HostConnectionPool condition) throws ConnectionException, UnsupportedProtocolVersionException, ClusterNameMismatchException {
        if (isClosing)
            return true;

        Lock l = poolCreationLocks.get(host);
        l.lock();
        try {
            HostConnectionPool previous = pools.get(host);
            if (previous != condition)
                return false;
View Full Code Here

    if (i == batchSize) {
      sinkCounter.incrementBatchCompleteCount();
    }
    sinkCounter.addToEventDrainAttemptCount(i);

    lock.lock();
    long startTime = System.nanoTime();
    long timeRemaining;
    try {
      while ((callbacksReceived.get() < callbacksExpected.get())
              && !txnFail.get()) {
View Full Code Here

    try {
      if (forkedFilter == null)
        return;

      Lock forkedLock = forkedFilter.lock.writeLock();
      forkedLock.lock();
      try {
        filter.position(0);
        forkedFilter.filter.position(0);

        filter.put(forkedFilter.filter);
View Full Code Here

          } catch (InterruptedException e) {
            e.printStackTrace();
          }
         
          Lock rl = rwl.writeLock();
          rl.lock();
          atom.incrementAndGet();
          rl.unlock();
         
          Lock wl = rwl.readLock();
          wl.lock();
View Full Code Here

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

                lock = new ReentrantLock();
                locks.put(target, lock);
            }
        }

        lock.lock();
        try {
            processExchange(exchange, target);
        } finally {
            // do not remove as the locks cache has an upper bound
            // this ensure the locks is appropriate reused
View Full Code Here

        unit.getTypes()[0].getFullyQualifiedName(), ILaunchManager.RUN_MODE);

    ILaunch launch = null;
    final Lock lock = new ReentrantLock();
    final Condition condition = lock.newCondition();
    lock.lock();
    try {
      // Wait for listener to be notified:
      while (listener.getLaunch(configName) == null) {
        condition.await(100, TimeUnit.MILLISECONDS);
      }
View Full Code Here

        pkg.getJavaProject().getElementName(),
        unit2.getTypes()[0].getFullyQualifiedName(), ILaunchManager.RUN_MODE);

    final Lock lock = new ReentrantLock();
    final Condition condition = lock.newCondition();
    lock.lock();
    try {
      while (listener.getLaunch(configName1) == null
          || listener.getLaunch(configName2) == null) {
        condition.await(100, TimeUnit.MILLISECONDS);
      }
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.