Examples of ReadWriteLock


Examples of java.util.concurrent.locks.ReadWriteLock

    _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.ReadWriteLock

   * Acquires a write lock on a specific key.
   * @param key The key to lock
   * @param timeout in milliseconds; -1 means wait indefinitely, 0 means no wait.
   */
  public void writeLock(EntityKey key, int timeout) {
    ReadWriteLock lock = getLock( key );
    Lock writeLock = lock.writeLock();
    acquireLock( key, timeout, writeLock );
  }
View Full Code Here

Examples of java.util.concurrent.locks.ReadWriteLock

   * Acquires a read lock on a specific key.
   * @param key The key to lock
   * @param timeout in milliseconds; -1 means wait indefinitely, 0 means no wait.
   */
  public void readLock(EntityKey key, int timeout) {
    ReadWriteLock lock = getLock( key );
    Lock readLock = lock.readLock();
    acquireLock( key, timeout, readLock );
  }
View Full Code Here

Examples of java.util.concurrent.locks.ReadWriteLock

    Lock readLock = lock.readLock();
    acquireLock( key, timeout, readLock );
  }

  private ReadWriteLock getLock(EntityKey key) {
    ReadWriteLock newLock = new ReentrantReadWriteLock();
    ReadWriteLock previous = dataLocks.putIfAbsent( key, newLock );
    return previous != null ? previous : newLock;
  }
View Full Code Here

Examples of java.util.concurrent.locks.ReadWriteLock

    this.committer = committer;
    this.newApiCommitter = newApiCommitter;

    this.taskAttemptListener = taskAttemptListener;
    this.eventHandler = eventHandler;
    ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
    this.readLock = readWriteLock.readLock();
    this.writeLock = readWriteLock.writeLock();

    this.jobCredentials = jobCredentials;
    this.jobTokenSecretManager = jobTokenSecretManager;

    this.aclsManager = new JobACLsManager(conf);
View Full Code Here

Examples of java.util.concurrent.locks.ReadWriteLock

    // Initialize reportedStatus
    reportedStatus = new TaskAttemptStatus();
    initTaskAttemptStatus(reportedStatus);

    ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
    readLock = readWriteLock.readLock();
    writeLock = readWriteLock.writeLock();

    this.credentials = credentials;
    this.jobToken = jobToken;
    this.eventHandler = eventHandler;
    this.jobFile = jobFile;
View Full Code Here

Examples of java.util.concurrent.locks.ReadWriteLock

        if (lifecycleManagerRegistry == null) {
            throw new NullPointerException("lifecycleManagerRegistry");
        }
        this.lifecycleManagerRegistry = lifecycleManagerRegistry;
        this.cacheByClass = new HashMap<Class<?>, ResourceRecord>();
        ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
        readersLock = readWriteLock.readLock();
        writersLock = readWriteLock.writeLock();
    }
View Full Code Here

Examples of java.util.concurrent.locks.ReadWriteLock

   * Acquires a write lock on a specific key.
   * @param key The key to lock
   * @param timeout in milliseconds; -1 means wait indefinitely, 0 means no wait.
   */
  public void writeLock(EntityKey key, int timeout) {
    ReadWriteLock lock = getLock( key );
    Lock writeLock = lock.writeLock();
    acquireLock( key, timeout, writeLock );
  }
View Full Code Here

Examples of java.util.concurrent.locks.ReadWriteLock

   * Acquires a read lock on a specific key.
   * @param key The key to lock
   * @param timeout in milliseconds; -1 means wait indefinitely, 0 means no wait.
   */
  public void readLock(EntityKey key, int timeout) {
    ReadWriteLock lock = getLock( key );
    Lock readLock = lock.readLock();
    acquireLock( key, timeout, readLock );
  }
View Full Code Here

Examples of java.util.concurrent.locks.ReadWriteLock

    Lock readLock = lock.readLock();
    acquireLock( key, timeout, readLock );
  }

  private ReadWriteLock getLock(EntityKey key) {
    ReadWriteLock newLock = new ReentrantReadWriteLock();
    ReadWriteLock previous = dataLocks.putIfAbsent( key, newLock );
    return previous != null ? previous : newLock;
  }
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.