Package java.util.concurrent.locks.ReentrantReadWriteLock

Examples of java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock.lock()


         * {@inheritDoc}
         */
        @Override
        public int getNumIdle() {
            ReadLock readLock = readWriteLock.readLock();
            readLock.lock();
            try {
                return pool.getNumIdle();
            } finally {
                readLock.unlock();
            }
View Full Code Here


         * {@inheritDoc}
         */
        @Override
        public int getNumActive() {
            ReadLock readLock = readWriteLock.readLock();
            readLock.lock();
            try {
                return pool.getNumActive();
            } finally {
                readLock.unlock();
            }
View Full Code Here

         * {@inheritDoc}
         */
        @Override
        public int getNumIdle(final K key) {
            ReadLock readLock = readWriteLock.readLock();
            readLock.lock();
            try {
                return keyedPool.getNumIdle(key);
            } finally {
                readLock.unlock();
            }
View Full Code Here

         * {@inheritDoc}
         */
        @Override
        public int getNumActive(final K key) {
            ReadLock readLock = readWriteLock.readLock();
            readLock.lock();
            try {
                return keyedPool.getNumActive(key);
            } finally {
                readLock.unlock();
            }
View Full Code Here

         * {@inheritDoc}
         */
        @Override
        public int getNumIdle() {
            ReadLock readLock = readWriteLock.readLock();
            readLock.lock();
            try {
                return keyedPool.getNumIdle();
            } finally {
                readLock.unlock();
            }
View Full Code Here

         * {@inheritDoc}
         */
        @Override
        public int getNumActive() {
            ReadLock readLock = readWriteLock.readLock();
            readLock.lock();
            try {
                return keyedPool.getNumActive();
            } finally {
                readLock.unlock();
            }
View Full Code Here

        }

        String version;

        ReadLock lock = dataLock.readLock();
        lock.lock();
        try {
            checkLoaded();
            version = data.getVersion(packageKey);
        } finally {
            lock.unlock();
View Full Code Here

        if (packageKey == null) {
            throw new IllegalArgumentException("packageKey cannot be null");
        }

        ReadLock lock = dataLock.readLock();
        lock.lock();
        try {
            checkLoaded();
            data.setVersion(packageKey, version);
        } finally {
            lock.unlock();
View Full Code Here

  private ReentrantReadWriteLock _lock = new ReentrantReadWriteLock();
 
  public <T> T runReadOperation(Callable<T> call) throws Exception
  {
    ReadLock rl = _lock.readLock();
    rl.lock();
    try {
      return call.call();
    } finally {
      rl.unlock();
    }
View Full Code Here

  }
 
  public void runReadOperation(Runnable r)
  {
    ReadLock rl = _lock.readLock();
    rl.lock();
    try {
      r.run();
    } finally {
      rl.unlock();
    }
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.