return null;
}
CacheEntry entry = getEntry(key);
Cacheable item;
try {
item = entry.getCacheable();
if (item != null) {
// The object is already cached. Increase the use count and
// return it.
entry.keep(true);
return item;
} else {
// The object is not cached. Insert the entry into a free
// slot and retrieve a reusable Cacheable.
item = insertIntoFreeSlot(key, entry);
}
} finally {
entry.unlock();
}
// Set the identity without holding the lock on the entry. If we
// hold the lock, we may run into a deadlock if the user code in
// setIdentity() re-enters the buffer manager.
Cacheable itemWithIdentity = null;
try {
itemWithIdentity = item.setIdentity(key);
} finally {
// Always invoke settingIdentityComplete(), also on error,
// otherwise other threads may wait forever. If setIdentity()