Package java.util.concurrent.locks.ReentrantReadWriteLock

Examples of java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock


          if(resultPool != null)
              resultPool.clear();
        }
        else
        {
          ReadLock readLock = job.getTrunkLock().readLock();
         
          try
          {
            if (readLock.tryLock(10, TimeUnit.MINUTES))
            {
              try
              {
                export(resultPool,destfile,true,true, job.getCursorMap());
              }
              finally{
                readLock.unlock();
              }
             
            }
            else
            {
View Full Code Here


        /**
         * {@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

    public void putVersion(String packageKey, String version) {
        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

Related Classes of java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock

Copyright © 2018 www.massapicom. 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.