> Sorry I wasn't as clear as I could have been - I realise JEE servers use a
> threadpool for handling requests, I was thinking of many other applications
> in the real world I'm aware of that don't (be that good design or
> otherwise...).
You was. I just wanted to point out that in real apps you're not going
to see stale data longer than for milliseconds (unless you're some
processor cache guru doing his black magic). Besides calling intern(),
threads synchronize in a gazillion other ways, and each sync updates
stale stuff.

>  I'm not sure I follow you though when you say "it won't even
> do a write" on a cache miss, it copies the (potentially stale) HashMap in
> that situation does it not?
On cache miss, I re-retrieve pool reference after a lock (HashMap is
no longer stale), re-read a string, and do the write only if the
string is still not there.

> I was only trying to raise the stale/visibility issue but it's clear you've
> already given that plenty of thought.
The truth is born in argument. I reread jmm docs to be sure, but I
can't guarantee I understood them well.

-- 
Kirill Zakharenko/Кирилл Захаренко (ear...@gmail.com)
Home / Mobile: +7 (495) 683-567-4 / +7 (903) 5-888-423
ICQ: 104465785

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to