public void acquireReadLock() throws InterruptedException { this.lock.attemptReadLock(-1, null); }
/** * An attempt to acquire reader lock should succeed when there are no writer * locks already taken (by calling {@link #attemptWriteLock}). The owner * argument is ignored since this is a non-reentrant lock and the behaviour is * identical to {@link #attemptReadLock(long)}. * * @param msecs * The timeout to wait for lock acquisition before failing. A value * equal to zero means not to wait at all, while a value less than * zero means to wait indefinitely. * * @return true if lock acquired successfully, false if the attempt timed out */ public final boolean attemptReadLock(long msecs, Object owner) { return attemptReadLock(msecs); }
this.generatedValuesLock.attemptReadLock(-1); try { Object[] id = this.generatedValues.get(table);
this.generatedValuesLock.attemptReadLock(-1); try { Object[] id = this.generatedValues.get(table);
this.generatedValuesLock.attemptReadLock(-1); try { Object[] id = this.generatedValues.get(table);
this.mapLock.attemptReadLock(-1); try { final TXFinished head = this.tail.next;
if (lock) { if (Thread.currentThread() != this.pendingTXRegionStatesLockOwner) { this.pendingTXRegionStatesLock.attemptReadLock(-1);
final boolean containsKey(final Object key, final int hash) { if (this.count != 0) { // read-volatile // GemStone change to acquire the read lock on list updates this.listUpdateLock.attemptReadLock(-1); HashEntry<K, V> e = getFirst(hash); try { while (e != null) { if (e.getEntryHash() == hash && equalityKeyCompare(key, e)) { return true; } e = e.getNextEntry(); } } finally { this.listUpdateLock.releaseReadLock(); } } return false; }
final V getNoLock(final Object key, final int hash, final boolean lockListForRead) { if (this.count != 0) { // read-volatile // GemStone change to acquire the read lock on list updates if (lockListForRead) { this.listUpdateLock.attemptReadLock(-1); } HashEntry<K, V> e = getFirst(hash); try { while (e != null) { if (e.getEntryHash() == hash && equalityKeyCompare(key, e)) { return e.getMapValue(); } e = e.getNextEntry(); } } finally { if (lockListForRead) { this.listUpdateLock.releaseReadLock(); } } } return null; }
this.pendingTXRegionStatesLock.attemptReadLock(-1);
RETRYLOOP: for (;;) { lock.attemptReadLock(-1); final HashEntry<K, V>[] tab = this.table; final int len = tab.length;
final V get(final Object key, final int hash) { if (this.count != 0) { // read-volatile // GemStone change to acquire the read lock on list updates this.listUpdateLock.attemptReadLock(-1); boolean lockAcquired = true; HashEntry<K, V> e = getFirst(hash); try { while (e != null) { if (e.getEntryHash() == hash && equalityKeyCompare(key, e)) { final V v = e.getMapValue(); if (v != null) { return v; } this.listUpdateLock.releaseReadLock(); lockAcquired = false; return readValueUnderLock(e); // recheck } e = e.getNextEntry(); } } finally { if (lockAcquired) { this.listUpdateLock.releaseReadLock(); } } } return null; }
RegionEntry re = getEntry(key); this.suspectEntriesLock.attemptReadLock(-1);