Package java.util.concurrent.locks

Examples of java.util.concurrent.locks.ReentrantReadWriteLock.writeLock()


    _delegate = new CacheMap();
    _uncachables = new CacheMap();
    _exclusionPatterns = new ArrayList<Exclusion>();
   
    ReentrantReadWriteLock _rwl = new ReentrantReadWriteLock();
        _writeLock = _rwl.writeLock();
        _readLock = _rwl.readLock();
  }
 
    public Boolean register(String id, Query query, FetchConfiguration hints) {
        if (id == null
View Full Code Here


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

    this.fsTokens = fsTokenCredentials;
    this.jobTokenSecretManager = jobTokenSecretManager;
    this.committer = committer;
View Full Code Here

    this.conf = conf;
    this.clock = clock;
    this.jobFile = remoteJobConfFile;
    ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
    readLock = readWriteLock.readLock();
    writeLock = readWriteLock.writeLock();
    this.attempts = Collections.emptyMap();
    // This overridable method call is okay in a constructor because we
    //  have a convention that none of the overrides depends on any
    //  fields that need initialization.
    maxAttempts = getMaxAttempts();
View Full Code Here

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

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

    this.fsTokens = fsTokens;
    this.jobToken = jobToken;
    this.eventHandler = eventHandler;
    this.committer = committer;
View Full Code Here

    public SocketWrapper(E socket) {
        this.socket = socket;
        ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
        this.blockingStatusReadLock = lock.readLock();
        this.blockingStatusWriteLock = lock.writeLock();
    }

    public E getSocket() {
        return socket;
    }
View Full Code Here

  public DirectUpdateHandler2(SolrCore core) throws IOException {
    super(core);

    ReadWriteLock rwl = new ReentrantReadWriteLock();
    iwAccess = rwl.readLock();
    iwCommit = rwl.writeLock();

    tracker = new CommitTracker();
  }

  // must only be called when iwCommit lock held
View Full Code Here

    super();
    this.storage = storage;
    deleteQueue = new DelayQueue<DelayedMCElement>();
    for (int i = 0; i < lockNum; i++) {
      ReadWriteLock lock = new ReentrantReadWriteLock();
      writeLocks[i] = lock.writeLock();
      readLocks[i] = lock.readLock();
    }
  }

  private void checkWritePermission() throws Exception {
View Full Code Here

        final int nbThreads = 10;
        final int nbExchanges = 10;
        final ReadWriteLock lock = new ReentrantReadWriteLock();
        final CountDownLatch latch = new CountDownLatch(nbThreads);
        final AtomicInteger id = new AtomicInteger();
        lock.writeLock().lock();
        for (int i = 0; i < nbThreads; i++) {
            new Thread() {
                public void run() {
                    Channel client = null;
                    try {
View Full Code Here

        final int nbThreads = 10;
        final int nbExchanges = 10;
        final ReadWriteLock lock = new ReentrantReadWriteLock();
        final CountDownLatch latch = new CountDownLatch(nbThreads);
        lock.writeLock().lock();
        for (int i = 0; i < nbThreads; i++) {
            new Thread() {
                public void run() {
                    Channel client = null;
                    try {
View Full Code Here

                }
            }.start();
        }

        cluster2.pause();
        lock.writeLock().unlock();
        Thread.sleep(0000);
        cluster2.resume();

        latch.await();
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.