Java Thread Lock downgradeWriteLock(final ReadWriteLock lock)

Here you can find the source of downgradeWriteLock(final ReadWriteLock lock)

Description

downgrade Write Lock

License

Open Source License

Declaration

public static void downgradeWriteLock(final ReadWriteLock lock) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;

public class Main {
    public static void downgradeWriteLock(final ReadWriteLock lock) {
        acquireReadLock(lock);/*  w  w  w . j  a  v a 2s .  c  om*/
        releaseWriteLock(lock);
    }

    public static void acquireReadLock(final ReadWriteLock lock) {
        acquireLock(lock.readLock());
    }

    public static void releaseWriteLock(final ReadWriteLock lock) {
        releaseLock(lock.writeLock());
    }

    public static void acquireLock(final Lock lock) {
        lock.lock();
    }

    public static void releaseLock(final Lock lock) {
        lock.unlock();
    }
}

Related

  1. canCreateNewThread()
  2. createConcurrentStack()
  3. fillReadWriteLocks(List readLocks, List writeLocks, int curSize, int size)
  4. getAllMessages()
  5. getGradingReadLock()
  6. getInstance()