: I tried initializing the cache in the constructor, but then the test case
: failed with a null pointer exception on the first synchronized(cache) .
: Very strange, this seems to be a bug in the implementation of java
: serialisation. The cache variable is transient, so it should not be affecte
On Tuesday 04 September 2007 21:03, Chris Hostetter wrote:
>
> : 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 conflictin
On 9/4/07, Chris Hostetter <[EMAIL PROTECTED]> wrote:
> : and should the cache accesses also use synchronized(this) ?
>
> I can't see a need for that ... then the same instance couldn't be used on
> two distinct readers in parallel threads ... but that should be fine.
synchronized (this) will prov
On Tuesday 04 September 2007 21:03, Chris Hostetter wrote:
>
> : 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 conflicti
: 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:
i believe you are write ... if Threa
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 initi