/** * Caller must hold latch. * * @return null if not found */ _Lock lockFor(long indexId, byte[] key, int hash) { _Lock[] entries = mEntries; int index = hash & (entries.length - 1); for (_Lock e = entries[index]; e != null; e = e.mLockManagerNext) { if (e.matches(indexId, key, hash)) { return e; } } return null; }
/** * Finds a lock or returns null if not found. Caller must hold latch. * * @return null if not found */ _Lock lockFor(long indexId, byte[] key, int hash) { _Lock[] entries = mEntries; int index = hash & (entries.length - 1); for (_Lock e = entries[index]; e != null; e = e.mLockManagerNext) { if (e.matches(indexId, key, hash)) { return e; } } return null; }
/** * Finds a lock or returns null if not found. Caller must hold latch. * * @return null if not found */ _Lock lockFor(long indexId, byte[] key, int hash) { _Lock[] entries = mEntries; int index = hash & (entries.length - 1); for (_Lock e = entries[index]; e != null; e = e.mLockManagerNext) { if (e.matches(indexId, key, hash)) { return e; } } return null; }
/** * Finds or creates a lock. Caller must hold exclusive latch. */ _Lock lockAccess(long indexId, byte[] key, int hash) { _Lock[] entries = mEntries; int index = hash & (entries.length - 1); for (_Lock lock = entries[index]; lock != null; lock = lock.mLockManagerNext) { if (lock.matches(indexId, key, hash)) { return lock; } } if (mSize >= mGrowThreshold) { entries = rehash(entries); index = hash & (entries.length - 1); } _Lock lock = new _Lock(); lock.mIndexId = indexId; lock.mKey = key; lock.mHashCode = hash; lock.mLockManagerNext = entries[index]; // Fence so that the isAvailable method doesn't observe a broken chain. UNSAFE.storeFence(); entries[index] = lock; mSize++; return lock; }
/** * Finds or creates a lock. Caller must hold exclusive latch. */ _Lock lockAccess(long indexId, byte[] key, int hash) { _Lock[] entries = mEntries; int index = hash & (entries.length - 1); for (_Lock lock = entries[index]; lock != null; lock = lock.mLockManagerNext) { if (lock.matches(indexId, key, hash)) { return lock; } } if (mSize >= mGrowThreshold) { entries = rehash(entries); index = hash & (entries.length - 1); } _Lock lock = new _Lock(); lock.mIndexId = indexId; lock.mKey = key; lock.mHashCode = hash; lock.mLockManagerNext = entries[index]; // Fence so that the isAvailable method doesn't observe a broken chain. UNSAFE.storeFence(); entries[index] = lock; mSize++; return lock; }
int index = hash & (entries.length - 1); for (lock = entries[index]; lock != null; lock = lock.mLockManagerNext) { if (lock.matches(newLock.mIndexId, newLock.mKey, hash)) { result = lock.tryLockExclusive(this, locker, nanosTimeout); break lockEx;
int index = hash & (entries.length - 1); for (lock = entries[index]; lock != null; lock = lock.mLockManagerNext) { if (lock.matches(newLock.mIndexId, newLock.mKey, hash)) { result = lock.tryLockExclusive(this, locker, nanosTimeout); break lockEx;
int index = hash & (entries.length - 1); for (lock = entries[index]; lock != null; lock = lock.mLockManagerNext) { if (lock.matches(newLock.mIndexId, newLock.mKey, hash)) { result = lock.tryLockExclusive(this, locker, nanosTimeout); break lockEx;
int index = hash & (entries.length - 1); for (lock = entries[index]; lock != null; lock = lock.mLockManagerNext) { if (lock.matches(indexId, key, hash)) { if (type == TYPE_SHARED) { result = lock.tryLockShared(this, locker, nanosTimeout);
int index = hash & (entries.length - 1); for (lock = entries[index]; lock != null; lock = lock.mLockManagerNext) { if (lock.matches(indexId, key, hash)) { if (type == TYPE_SHARED) { result = lock.tryLockShared(this, locker, nanosTimeout);
int index = hash & (entries.length - 1); for (lock = entries[index]; lock != null; lock = lock.mLockManagerNext) { if (lock.matches(indexId, key, hash)) { if (type == TYPE_SHARED) { result = lock.tryLockShared(this, locker, nanosTimeout);