Java Thread Lock getPropLock(String s)

Here you can find the source of getPropLock(String s)

Description

get Prop Lock

License

Open Source License

Declaration

private static ReentrantReadWriteLock getPropLock(String s) 

Method Source Code

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

import java.util.HashMap;

import java.util.Map;

import java.util.concurrent.locks.ReentrantReadWriteLock;

public class Main {
    private static final Object LOCK_MONITOR = new Object();
    private static final Map<String, ReentrantReadWriteLock> locks = new HashMap<>();

    private static ReentrantReadWriteLock getPropLock(String s) {
        assert Thread.holdsLock(LOCK_MONITOR);
        if (locks.containsKey(s)) {
            return locks.get(s);
        }/*from   w w  w.  j  a  v  a2s  .  c  om*/
        ReentrantReadWriteLock l = new ReentrantReadWriteLock();
        locks.put(s, l);
        return l;
    }
}

Related

  1. fillReadWriteLocks(List readLocks, List writeLocks, int curSize, int size)
  2. getAllMessages()
  3. getGradingReadLock()
  4. getInstance()
  5. getLocaleProperties(Locale locale)
  6. loadClass(String className)
  7. loadClassWithRegisteredClassLoaders(String className)
  8. lock(Lock lock)
  9. lock(Lock lock)