[concurrency-interest] Pooled executor and data visibility

David Holmes dholmes at dltech.com.au
Mon May 9 20:09:11 EDT 2005


Phil,

When thread-B acquires a monitor that was released by thread-A then ALL
writes performed by thread-A before releasing the monitor are visible to
thread-B when it acquires the monitor.

In terms of the memory-model, everything that happens-before the release of
a monitor in one thread, happens before a subsequent acquire of the same
monitor in another thread. This is spelt out in the Java Memory Model spec
which is in chapter 17 of the Java Language Specification, 3rd edition.

http://java.sun.com/docs/books/jls/index.html

Cheers,
David Holmes

> -----Original Message-----
> From: concurrency-interest-bounces at cs.oswego.edu
> [mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of Lee,
> Phil
> Sent: Tuesday, 10 May 2005 12:32 AM
> To: concurrency-interest at altair.cs.oswego.edu
> Subject: [concurrency-interest] Pooled executor and data visibility
>
>
> Hi,
>
> I am using a PooledExecutor to handle events arriving for a large number
> of session objects. If all Runnables passed to the PooledExecutor invoke
> Session::work() then can I get away with just making Session::work()
> synchronized to ensure that all data modifications are visibile to any
> other thread than handles a subsequent event for a that session. Put
> another way, do the cache flush/invalidate effects of synchronized
> extend to all data fields of all objects touched by calls made within
> the synchronized block or are they limited to the object upon which
> synchronized is operating. (I'm guessing it's the latter and hoping it's
> the former but I haven't seen it spelt out anywhere :).
>
> TIA,
>
> 	Phil.
>
>
> This e-mail and any attachment is for authorised use by the
> intended recipient(s) only. It may contain proprietary material,
> confidential information and/or be subject to legal privilege. It
> should not be copied, disclosed to, retained or used by, any
> other party. If you are not an intended recipient then please
> promptly delete this e-mail and any attachment and all copies and
> inform the sender. Thank you.
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>



More information about the Concurrency-interest mailing list