Package java.util.concurrent.locks.ReentrantReadWriteLock

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


            readLock.unlock();
        }

        if (!readDone) {
            try {
                writeLock.lock();
                wrapper.setBlockingStatus(block);
                // Set the current settings for this socket
                if (block) {
                    Socket.optSet(socket, Socket.APR_SO_NONBLOCK, 0);
                } else {
View Full Code Here


            readLock.unlock();
        }

        if (!readDone) {
            try {
                writeLock.lock();
                socketWrapper.setBlockingStatus(block);
                // Set the current settings for this socket
                Socket.optSet(socket, Socket.APR_SO_NONBLOCK, (block ? 0 : 1));
                // Downgrade the lock
                try {
View Full Code Here

            readLock.unlock();
        }

        if (!readDone) {
            try {
                writeLock.lock();
                wrapper.setBlockingStatus(block);
                // Set the current settings for this socket
                Socket.optSet(socket, Socket.APR_SO_NONBLOCK, (block ? 0 : 1));
                // Downgrade the lock
                try {
View Full Code Here

  }
 
  public <T> T runWriteOperation(Callable<T> call) throws Exception
  {
    WriteLock wl = _lock.writeLock();
    wl.lock();
    try {
      return call.call();
    } finally {
      wl.unlock();
    }
View Full Code Here

  }
 
  public void runWriteOperation(Runnable r)
  {
    WriteLock wl = _lock.writeLock();
    wl.lock();
    try {
      r.run();
    } finally {
      wl.unlock();
    }
View Full Code Here

         */
        @Override
        public V borrowObject(final K key) throws Exception,
                NoSuchElementException, IllegalStateException {
            WriteLock writeLock = readWriteLock.writeLock();
            writeLock.lock();
            try {
                return keyedPool.borrowObject(key);
            } finally {
                writeLock.unlock();
            }
View Full Code Here

         * {@inheritDoc}
         */
        @Override
        public void returnObject(final K key, final V obj) {
            WriteLock writeLock = readWriteLock.writeLock();
            writeLock.lock();
            try {
                keyedPool.returnObject(key, obj);
            } catch (Exception e) {
                // swallowed
            } finally {
View Full Code Here

         * {@inheritDoc}
         */
        @Override
        public void invalidateObject(final K key, final V obj) {
            WriteLock writeLock = readWriteLock.writeLock();
            writeLock.lock();
            try {
                keyedPool.invalidateObject(key, obj);
            } catch (Exception e) {
                // swallowed as of Pool 2
            } finally {
View Full Code Here

         */
        @Override
        public void addObject(final K key) throws Exception,
                IllegalStateException, UnsupportedOperationException {
            WriteLock writeLock = readWriteLock.writeLock();
            writeLock.lock();
            try {
                keyedPool.addObject(key);
            } finally {
                writeLock.unlock();
            }
View Full Code Here

         * {@inheritDoc}
         */
        @Override
        public void clear() throws Exception, UnsupportedOperationException {
            WriteLock writeLock = readWriteLock.writeLock();
            writeLock.lock();
            try {
                keyedPool.clear();
            } finally {
                writeLock.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.