You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@artemis.apache.org by jb...@apache.org on 2026/09/03 02:19:21 UTC

(artemis) branch main updated: ARTEMIS-6218 Avoid calling proxy.getMBeanInfo inside loop

This is an automated email from the ASF dual-hosted git repository.

jbertram pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new 60aab14959 ARTEMIS-6218 Avoid calling proxy.getMBeanInfo inside loop
60aab14959 is described below

commit 60aab149590a6c7cc394e494c493f53809945874
Author: gchuf <ga...@gmail.com>
AuthorDate: Sat Aug 29 13:44:37 2026 +0200

    ARTEMIS-6218 Avoid calling proxy.getMBeanInfo inside loop
---
 .../core/server/management/ArtemisMBeanServerGuard.java  | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ArtemisMBeanServerGuard.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ArtemisMBeanServerGuard.java
index f7cd7c3dc6..3723625232 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ArtemisMBeanServerGuard.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ArtemisMBeanServerGuard.java
@@ -74,7 +74,10 @@ public class ArtemisMBeanServerGuard implements GuardInvocationHandler {
    }
 
    private void handleGetAttribute(MBeanServer proxy, ObjectName objectName, String attributeName) throws JMException, IOException {
-      MBeanInfo info = proxy.getMBeanInfo(objectName);
+      handleGetAttribute(proxy.getMBeanInfo(objectName), objectName, attributeName);
+   }
+
+   private void handleGetAttribute(MBeanInfo info, ObjectName objectName, String attributeName) throws JMException, IOException {
       String prefix = null;
       for (MBeanAttributeInfo attr : info.getAttributes()) {
          if (attr.getName().equals(attributeName)) {
@@ -93,14 +96,18 @@ public class ArtemisMBeanServerGuard implements GuardInvocationHandler {
    }
 
    private void handleGetAttributes(MBeanServer proxy, ObjectName objectName, String[] attributeNames) throws JMException, IOException {
+      MBeanInfo info = proxy.getMBeanInfo(objectName);
       for (String attr : attributeNames) {
-         handleGetAttribute(proxy, objectName, attr);
+         handleGetAttribute(info, objectName, attr);
       }
    }
 
    private void handleSetAttribute(MBeanServer proxy, ObjectName objectName, Attribute attribute) throws JMException, IOException {
+      handleSetAttribute(proxy.getMBeanInfo(objectName), objectName, attribute);
+   }
+
+   private void handleSetAttribute(MBeanInfo info, ObjectName objectName, Attribute attribute) throws JMException, IOException {
       String dataType = null;
-      MBeanInfo info = proxy.getMBeanInfo(objectName);
       for (MBeanAttributeInfo attr : info.getAttributes()) {
          if (attr.getName().equals(attribute.getName())) {
             dataType = attr.getType();
@@ -116,8 +123,9 @@ public class ArtemisMBeanServerGuard implements GuardInvocationHandler {
    }
 
    private void handleSetAttributes(MBeanServer proxy, ObjectName objectName, AttributeList attributes) throws JMException, IOException {
+      MBeanInfo info = proxy.getMBeanInfo(objectName);
       for (Attribute attr : attributes.asList()) {
-         handleSetAttribute(proxy, objectName, attr);
+         handleSetAttribute(info, objectName, attr);
       }
    }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@artemis.apache.org
For additional commands, e-mail: commits-help@artemis.apache.org