[JSR308] Concurrency annotations on blocks
Eugene Kuleshov
eu at javatx.org
Sat Feb 3 14:25:40 EST 2007
Tom Ball wrote:
>>>> I can't speak for Intel, but from my practice, one example also
>>>> not mentioned in Java Concurrency in Practice is properties of the
>>>> locking. For instance read or write lock, optimistic vs. eager
>>>> locking. It is too coarse grained to express those on the method
>>>> level only.
>>> Wouldn't checking the java.util.concurrent class type or method
>>> usage tell you that? I'm not arguing that those are important
>>> things to check, but am just trying to understand what the
>>> annotation adds that isn't already clearly expressed in the code.
>> Probably. But only if those locks are used.
> Which they should be, if clients need that sort of functionality.
Not necessarily. As Doug Lea pointed out, "that sort of functionality"
can be platform or environment-specific optimization. So, optimize and
clutter code with more heavy weight locking constructs may not be
appropriate for the sake of code simplicity.
> Annotations aren't supposed to be used instead of good code.
They aren't. Code would produce the same result without
post-processor. However in certain circumstances post processor can make
same code to run faster if it can use hints. That would help to make it
easy to writing multi threaded code as well as simplify coding for the
grid computing.
I am not making this up and these tools already exist on the marked
(JBoss Cache, Terracotta), but they are suffering from the limitations
of the current metadata facility and have to workaround those limitations.
regards,
Eugene
More information about the JSR308
mailing list