On 21/04/2016 17:07, Peter Levart wrote:
:
...while this seems OK from 1st look, it is not. WeakHashMap is not
thread-safe even for seemingly read-only operations. All its
operations can mutate internal state in a non-thread-safe way. The
simplest way to fix this is to use a writeLock for containsKey
operation too. But such structure does not scale well to multiple
threads for frequent lookups.
Sigh, it's a left over from early prototyping and was meant to be
replaced (but wasn't). Now seems the right time.
-Alan