Author: epbernard
Date: 2008-09-03 23:16:02 -0400 (Wed, 03 Sep 2008)
New Revision: 15152
Modified:
search/trunk/src/java/org/hibernate/search/filter/CachingWrapperFilter.java
Log:
Make CachingWrapperFilter thread safe
Modified: search/trunk/src/java/org/hibernate/search/filter/CachingWrapperFilter.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/filter/CachingWrapperFilter.java 2008-08-29
18:42:57 UTC (rev 15151)
+++ search/trunk/src/java/org/hibernate/search/filter/CachingWrapperFilter.java 2008-09-04
03:16:02 UTC (rev 15152)
@@ -33,7 +33,7 @@
*/
private transient SoftLimitMRUCache cache;
- private Filter filter;
+ private final Filter filter;
/**
* @param filter
@@ -58,6 +58,7 @@
cache = new SoftLimitMRUCache(size);
}
+ //memory barrier ensure cache == null will not always stay true on concurrent threads
synchronized (cache) { // check cache
BitSet cached = (BitSet) cache.get(reader);
if (cached != null) {