Package java.util.concurrent.locks

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


    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

        }
    }

    @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

    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

        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

    _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

    _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

      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

   *
   * @param region the region to connect to
   */
  public IdxRegionIndexManager(IdxRegion region) {
    this.region = region;
    indexSwitchLock = new ReentrantReadWriteLock();
    heapSize = FIXED_SIZE;
  }
View Full Code Here

  protected int crossCatalogResultSortingThreshold;
 
  public CatalogServiceLocal(CatalogRepository catalogRepository, IngestMapper ingestMapper, File pluginStorageDir, TransactionIdFactory transactionIdFactory, boolean restrictQueryPermissions, boolean restrictIngestPermissions, boolean oneCatalogFailsAllFail, boolean simplifyQueries, boolean disableIntersectingCrossCatalogQueries, int crossCatalogResultSortingThreshold) throws InstantiationException {
    try {
      this.catalogs = new HashSet<Catalog>();
      this.catalogsLock = new ReentrantReadWriteLock();
      this.ingestMapperLock = new ReentrantReadWriteLock();
      this.setPluginStorageDir(pluginStorageDir);
      this.setRestrictQueryPermissions(restrictQueryPermissions);
      this.setRestrictIngestPermissions(restrictIngestPermissions);
      this.setTransactionIdFactory(transactionIdFactory);
      this.setIngestMapper(ingestMapper);
View Full Code Here

TOP

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

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.