List of usage examples for java.util.concurrent.locks ReentrantReadWriteLock hashCode
@HotSpotIntrinsicCandidate public native int hashCode();
From source file:Main.java
private static String getLockInfo(ReentrantReadWriteLock lock) { String lockid = "RWLock@" + Integer.toHexString(lock.hashCode()); return lockid + " readLockCount=" + lock.getReadLockCount() + " isWriteLocked=" + lock.isWriteLocked(); }
From source file:io.hops.hopsworks.common.security.CertificateMaterializer.java
private TreeSet<ReentrantReadWriteLock> acquireWriteLocks(Map<MaterialKey, ReentrantReadWriteLock> lockSet) { TreeSet<ReentrantReadWriteLock> acquiredLocks = new TreeSet<>(new Comparator<ReentrantReadWriteLock>() { @Override/*from w ww. jav a 2s . c om*/ public int compare(ReentrantReadWriteLock t0, ReentrantReadWriteLock t1) { if (t0.hashCode() < t1.hashCode()) { return -1; } else if (t0.hashCode() > t1.hashCode()) { return 1; } return 0; } }); lockSet.values().stream().forEach(l -> { l.writeLock().lock(); acquiredLocks.add(l); }); return acquiredLocks; }