ARTEMIS-3741 Cache MBeanInfoHelper results
authorJustin Bertram <jbertram@apache.org>
Wed, 23 Mar 2022 20:50:19 +0000 (15:50 -0500)
committerJustin Bertram <jbertram@apache.org>
Wed, 30 Mar 2022 16:57:28 +0000 (11:57 -0500)
commit5d970576da13b14b7b1cb48ebd9e7f3c731b44c4
tree56649c7b055da0ed7913cf5f310bcdf2d831c61a
parent3ec88c5ea49bb91bd2f3ea3fbc808449a8be538f
ARTEMIS-3741 Cache MBeanInfoHelper results

The utility methods in
`org.apache.activemq.artemis.core.management.impl.MBeanInfoHelper` are
executed *a lot* - especially for Jolokia which is used by the web
console. The `MBeanOperationInfo` and `MBeanAttributeInfo` results are
static and reflection is slow therefore they should not be calculated
over and over again. Rather they should be calculated once and cached
for later use.

Caching these results significantly improves performance. Over the
course of 1,000,000 invocations the difference is several orders of
magnitude. This improves usability substantially when dealing with,
for example, tens of thousands of addresses and/or queues.
artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/MBeanInfoHelper.java
artemis-server/src/test/java/org/apache/activemq/artemis/core/management/impl/MBeanInfoHelperTest.java [new file with mode: 0644]