Examples of ReentrantReadWriteLock


Examples of java.util.concurrent.locks.ReentrantReadWriteLock

  private Map<Supplier, Object> supplierCache;
  private List<Blob> blobsToSave;
  private List<Blob> blobsToDelete;

  public ObjectDatabase(PersistenceEngine persistenceEngine) {
    this.lock = new ReentrantReadWriteLock();
    this.objectRepository = new ObjectRepository();
    this.supplierCache = new HashMap();
    this.persistenceEngine = persistenceEngine;
  }
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

   public void readExternal(java.io.ObjectInput in)
      throws java.io.IOException, ClassNotFoundException
   {
      this.guid = (GUID)in.readObject();
      this.timeout = in.readLong();
      this.lock = new ReentrantReadWriteLock();
   }
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

    public void tearDown() {
    }

    @Test
    public void testWithLocking() {
        ReentrantReadWriteLock readWriteLock = dhns.getReadWriteLock();
        Lock lock = readWriteLock.readLock();

        for (int i = 0; i < 100000; i++) {
            lock.lock();
            int degree = singleNode.getEdgesInTree().getCount() + singleNode.getEdgesOutTree().getCount();
            lock.unlock();
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

        }
    }

    @Test
    public void testWithGlobalLocking() {
        ReentrantReadWriteLock readWriteLock = dhns.getReadWriteLock();
        Lock lock = readWriteLock.readLock();

        lock.lock();
        for (int i = 0; i < 100000; i++) {
            lock.lock();
            int degree = singleNode.getEdgesInTree().getCount() + singleNode.getEdgesOutTree().getCount();
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

    public void readUnlock() {
        readWriteLock.readLock().unlock();
    }

    public void readUnlockAll() {
        ReentrantReadWriteLock lock = readWriteLock;
        final int nReadLocks = lock.getReadHoldCount();
        for (int n = 0; n < nReadLocks; n++) {
            lock.readLock().unlock();
        }
    }
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

        if (lifecycleManagerRegistry == null) {
            throw new NullPointerException("lifecycleManagerRegistry"); //$NON-NLS-1$
        }
        this.lifecycleManagerRegistry = lifecycleManagerRegistry;
        this.cacheByClass = new HashMap<Class<?>, ResourceRecord>();
        ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
        readersLock = readWriteLock.readLock();
        writersLock = readWriteLock.writeLock();

        if (customProperties == null) {
            customProperties = new Properties();
        }
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

    _readWrite = new BlockReadWrite(this, path, isEnableMmap);

    _writer = new BlockWriter(this);

    if (rowLock == null)
      rowLock = new ReentrantReadWriteLock();

    rowLock.readLock();
    _rowWriteLock = rowLock.writeLock();
  }
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

    _store = store;
    _blockId = blockId;

    // _lock = new Lock("block:" + store.getName() + ":" + Long.toHexString(_blockId));
    // ReadWriteLock rwLock = new ReentrantReadWriteLock();
    ReadWriteLock rwLock = new ReentrantReadWriteLock();
   
    _readLock = rwLock.readLock();
    _writeLock = rwLock.writeLock();

    _isFlushDirtyOnCommit = _store.isFlushDirtyBlocksOnCommit();

    _buffer = allocateBuffer();
   
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

      revert();
      return;
    }

    // Save the content
    ReentrantReadWriteLock l = new ReentrantReadWriteLock();
    try {
      l.writeLock().lock();
      if (this.originalPackagePath != null
          && !"".equals(this.originalPackagePath.trim())) {
        File targetFile = new File(this.originalPackagePath);
        if (!targetFile.exists()
            || !(this.originalPackagePath
                .equalsIgnoreCase(targetFile.getAbsolutePath()))) {
          // Case of a package created from scratch
          save(targetFile);
        } else {
          closeImpl();
        }
      } else if (this.output != null) {
        save(this.output);
        output.close();
      }
    } finally {
      l.writeLock().unlock();
    }

    // Clear
    this.contentTypeManager.clearAll();
  }
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

   *
   * @param region the region to connect to
   */
  public IdxRegionIndexManager(IdxRegion region) {
    this.region = region;
    indexSwitchLock = new ReentrantReadWriteLock();
    heapSize = FIXED_SIZE;
  }
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.