On 11/1/2012 7:11 AM, Alan Bateman wrote:
On 01/11/2012 13:17, Alexander Knöller wrote:
Hi there.
java.lang.Class.getAnnotations() always enters a synchronized-block,
slowing down multi core machines that heavily make use of Annotations.
(in our Case we use LoadTimeWeaving in the spring-framework 3.1.2)
We are using sun-jdk 6 which has the same performance-bottleneck.
openjdk7 and 8 show no fix so far, although it looks like it might be
possible to build a kind of double-checked locking?
Has this issue ever been persued?
Special Regards
Alex Knöller
If you have a proposal then I suggest bringing it to core-libs-dev for
discussion. In addition to contention there are other issues that need
attention there too, particularly the potential to deadlock and the
overhead per Class when annotations aren't used. There's definitely
some useful work that could be done there.
Note that the block in question is synchronized so that getAnnotations
returns the right result if the class has been redefined at runtime
using an API for that purpose.
-Joe