[concurrency-interest] ConcurrentHashMap NullPointerException
Online at stolsvik.com
Sat Jan 5 11:14:44 EST 2008
BJ Low wrote:
> At time t1, Thread-X submits a Runnable to threadpool,
> At time t2, Thread-1 from the threadpool runs the Runnable and call
> AFTER changeVal(1) from Thread-1 is completed, then at time t3 ....
> At time t3, Thread-X submits another Runnable to threadpool
> At time t4, Thread-2 from the threadpool runs the Runnable and call
> .... i missed out the red statement above.
Pretty vital little piece, don't you think?
> I think in above case, the
> happens-before property is very important, cause if at t3, it is
> Thread-1, but not Thread-X that submits the Runnable, then there will
> not be any memory consistency errors.
How do you KNOW that the "red statement" has happened? That is, that the
changeVal(1) from Thread-1 is completed??
Because I can't quite see how that information is transmitted _without_
a happens-before edge being established at the same time - thereby
ensuring that Thread-2 will see the 1.
More information about the Concurrency-interest