I'm trying to change the CachingWrapperFilter class to cache a SortedVIntList for LUCENE-584. That is progressing nicely, but I found this snippet at the beginning of the current CachingWrapperFilter.bits() method:
if (cache == null) { cache = new WeakHashMap(); } I think the initial snippet is not thread safe and might result in two threads initializing this cache to different objects, possibly conflicting with the cache accesses after that: synchronized (cache) { ... cache.get(...); } ... synchronized (cache) { cache.put(...); } Would this be safe to initialize the cache: synchronized(this) { if (cache == null) { cache = new WeakHashMap(); } } and should the cache accesses also use synchronized(this) ? Regards, Paul Elschot --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]