|
|
@ -427,8 +427,15 @@ public final class ReferenceContainerCache<ReferenceType extends Reference> exte
|
|
|
|
synchronized (cache) {
|
|
|
|
synchronized (cache) {
|
|
|
|
ReferenceContainer<ReferenceType> containerNew = cache.put(tha, container);
|
|
|
|
ReferenceContainer<ReferenceType> containerNew = cache.put(tha, container);
|
|
|
|
if (containerNew == null) return;
|
|
|
|
if (containerNew == null) return;
|
|
|
|
container.putAllRecent(containerNew);
|
|
|
|
// Now merge the smaller container into the lager.
|
|
|
|
cache.put(tha, container);
|
|
|
|
// The other way around can become very slow
|
|
|
|
|
|
|
|
if (container.size() >= containerNew.size()) {
|
|
|
|
|
|
|
|
container.putAllRecent(containerNew);
|
|
|
|
|
|
|
|
cache.put(tha, container);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
containerNew.putAllRecent(container);
|
|
|
|
|
|
|
|
cache.put(tha, containerNew);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|