protected void removeOne(Cacheable item) {
boolean removed = false;
SequencedLongHashMap.Entry<Cacheable> next = map.getFirstEntry();
int tries = 0;
do {
final Cacheable cached = next.getValue();
if(cached.getKey() != item.getKey()) {
final Collection old = (Collection) cached;
final Lock lock = old.getLock();
if (lock.attempt(Lock.READ_LOCK)) {
try {
if (cached.allowUnload()) {
if(pool.getConfigurationManager()!=null) { // might be null during db initialization
pool.getConfigurationManager().invalidate(old.getURI(), null);
}
names.remove(old.getURI().getRawCollectionPath());
cached.sync(true);
map.remove(cached.getKey());
removed = true;
}
} finally {
lock.release(Lock.READ_LOCK);
}