mirror of https://github.com/apache/lucene.git
SOLR-14576 : Do not use SolrCore as keys in a WeakHashMap (#1586)
This commit is contained in:
parent
7a13e81668
commit
8c41418c0f
|
@ -193,7 +193,7 @@ Improvements
|
|||
|
||||
* SOLR-14905: Update commons-io version to 2.8.0 due to security vulnerability. (Nazerke Seidan via Bruno Roustant)
|
||||
|
||||
* SOLR-14691: Metrics reporting should avoid creating objects. (ab, Noble Paul)
|
||||
* SOLR-14691: Metrics reporting should avoid creating objects. (ab, noble)
|
||||
|
||||
Optimizations
|
||||
---------------------
|
||||
|
@ -212,6 +212,8 @@ Optimizations
|
|||
* SOLR-14658: SolrJ's CollectionAdminRequest.collectionStatus(collection) would internally get
|
||||
all collection statuses instead of just the specified collection. (Andy Vuong)
|
||||
|
||||
* SOLR-14576 : Do not use SolrCore as keys in a WeakHashMap (noble)
|
||||
|
||||
Bug Fixes
|
||||
---------------------
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.io.IOException;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
@ -54,7 +55,7 @@ public final class HttpCacheHeaderUtil {
|
|||
*
|
||||
* @see #calcEtag
|
||||
*/
|
||||
private static WeakIdentityMap<SolrCore, EtagCacheVal> etagCoreCache = WeakIdentityMap.newConcurrentHashMap();
|
||||
private static WeakIdentityMap<UUID, EtagCacheVal> etagCoreCache = WeakIdentityMap.newConcurrentHashMap();
|
||||
|
||||
/** @see #etagCoreCache */
|
||||
private static class EtagCacheVal {
|
||||
|
@ -89,12 +90,12 @@ public final class HttpCacheHeaderUtil {
|
|||
final long currentIndexVersion
|
||||
= solrReq.getSearcher().getIndexReader().getVersion();
|
||||
|
||||
EtagCacheVal etagCache = etagCoreCache.get(core);
|
||||
EtagCacheVal etagCache = etagCoreCache.get(core.uniqueId);
|
||||
if (null == etagCache) {
|
||||
final String etagSeed
|
||||
= core.getSolrConfig().getHttpCachingConfig().getEtagSeed();
|
||||
etagCache = new EtagCacheVal(etagSeed);
|
||||
etagCoreCache.put(core, etagCache);
|
||||
etagCoreCache.put(core.uniqueId, etagCache);
|
||||
}
|
||||
|
||||
return etagCache.calcEtag(currentIndexVersion);
|
||||
|
|
Loading…
Reference in New Issue