A hint to anyone working on the locking: the key to success is the "Java Memory Model".
With your code level instructions, or as in my case at times the lack of such, your compiler will receive instructions on on how your specified code execution order may be reorderable when it actually runs. And the compiler/jvm's interpretation will vary between java versions!
So, your code may actually execute in another order to what you think it is according to your written code.
I would dare to say if you are using, but not fully across the Java Memory Model implication of synchronize AND volatile AND final (or equivalent util.concurrent abstractions), your locking may likely be (like mine) in elements inferior/incomplete. This is not to say it doesn't work on your machine, but will it on a dual or quad core, or in exceptional conditions (e.g. exttremely high load), or with another java version?
If you are not across java concurrency as above, listen to this podcast for an instant AHA effect .
Have fun understanding Java better than many others.
[ February 19, 2008: Message edited by: Chris Be ] [ February 19, 2008: Message edited by: Chris Be ]
ChrisBe<br />-------<br />SCJP, SCJD, SCEA in the making
Alex Belisle Turcot
posted 7 years ago
Wow, thanks Chris, as always your post are really informative (last one being the anti-patterns for Exception).
You really opened my eyes on a beast. I didn't even begin to suspect such thing.