Speed up augmentable class serialization
During debugging an unrelated issue, we have noticed the following
cropping up in thread dumps quite often:
java.lang.Thread.State: RUNNABLE
at sun.reflect.Reflection.getCallerClass(Native Method)
at java.lang.Class.getDeclaredField(Unknown Source)
at org.opendaylight.yangtools.sal.binding.generator.impl.LazyGeneratedCodecRegistry$AugmentableDispatchCodec.getAugmentations(LazyGeneratedCodecRegistry.java:977)
at org.opendaylight.yangtools.sal.binding.generator.impl.LazyGeneratedCodecRegistry$AugmentableDispatchCodec.serialize(LazyGeneratedCodecRegistry.java:968)
at org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.Bandwidth$Broker$Codec$DOM.toDomStatic(Bandwidth$Broker$Codec$DOM.java)
at org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.pcep.client.attributes.path.computation.client.reported.lsp.Path$Broker$Codec$DOM.toDomStatic(Path$Broker$Codec$DOM.java)
Leading to conjecture that the native call is pretty costly. This
patch introduces a weakly-keyed cache of reflection handles, which
should improve performance.
Change-Id: Ie7001df912c47c77bee8127a2258e8a6a4dce469
Signed-off-by: Robert Varga <rovarga@cisco.com>