Package java.util.concurrent.locks

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


    @Override
    public final void release(T x) {
        Lock lock0 = locks[0][hash0(x) % locks[0].length];
        Lock lock1 = locks[1][hash1(x) % locks[1].length];
        lock0.unlock();
        lock1.unlock();
    }

    /**
     * Ensure that no thread is currently locking the set.
     */
 
View Full Code Here


                        lock.lock();
                        try {
                            all_msgs_delivered.signalAll();
                        }
                        finally {
                            lock.unlock();
                        }
                    }
                }
                return null;
            }
View Full Code Here

                    e.printStackTrace();
                }
            }
        }
        finally {
            lock.unlock();
        }

        long time=System.currentTimeMillis() - start;
        double requests_sec=num_msgs / (time / 1000.0);
        System.out.println("\nTime: " + time + " ms, " + Util.format(requests_sec) + " requests / sec\n");
View Full Code Here

          postLockingResult(str);
          // Sleep again and then release the lock.
          TestingUtil.sleepThread(SLEEP_MSECS);
          if (wlock != null)
          {
             wlock.unlock();
          }
          rlock.unlock();
          notifyBeforeFinish.countDown();
          if (beforeFinishWait != null) beforeFinishWait.await(10, TimeUnit.SECONDS);
       }
View Full Code Here

      directoryProviderLock.lock(); //needed for same problem as the double-checked locking
      try {
        reader = activeSearchIndexReaders.get( directoryProvider );
      }
      finally {
        directoryProviderLock.unlock();
      }
      if ( reader == null ) {
        if ( trace )
          log.trace( "No shared IndexReader, opening a new one: " + directoryProvider.getDirectory().toString() );
        reader = replaceActiveReader( null, directoryProviderLock, directoryProvider, readers );
View Full Code Here

            finally {
              semaphoreIndexReaderLock.unlock();
            }
          }
          finally {
            directoryProviderLock.unlock();
          }
        }
      }
      readers[index] = reader;
    }
View Full Code Here

        finally {
          semaphoreIndexReaderLock.unlock();
        }
      }
      finally {
        directoryProviderLock.unlock();
      }

      if ( closeReader ) {
        if ( trace ) log.trace( "Closing IndexReader: " + subReader );
        try {
View Full Code Here

            public void run() {
                runLock.lock();
                try {
                    runCondition.signal();
                } finally {
                    runLock.unlock();
                }
            }
        };
       
        workqueue.schedule(doNothing, 5000);
View Full Code Here

       
        runLock.lock();
        try {
            runCondition.await();
        } finally {
            runLock.unlock();
        }
       
        assertTrue("expected delay",
                   System.currentTimeMillis() - start >= 4950);
    }
View Full Code Here

            //the events.
            ((News) changedNewsItem).acquireReadLockSpecial();
            eventRunnable.addCheckedUpdateEvent(createSaveEventTemplate(changedNewsItem));
          }
          condition.signal();
          setStateLock.unlock();
          save(changedNews);
          fDb.commit();
        } catch (Db4oException e) {
          throw new PersistenceException(e);
        } 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.