jchen21 commented on a change in pull request #6770:
URL: https://github.com/apache/geode/pull/6770#discussion_r692499907



##########
File path: 
geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
##########
@@ -449,20 +463,15 @@ public synchronized void start() throws IOException {
       if (accessFile != null && accessFile.length() > 0) {
         // Rewire the mbs hierarchy to set accessController
         ReadOpFileAccessController controller = new 
ReadOpFileAccessController(accessFile);
-        controller.setMBeanServer(mbs);
+        if (jmxConnectorServer.getMBeanServer() == null) {

Review comment:
       If you look at the implementation of `JMXConnectorServer. 
setMBeanServerForwarder()`, if the MBeanServer of the connector server is 
non-null, it will set the MBeanServer for the forwarder, which is the 
`controller` in our case. We want to avoid setting the MBeanServer twice for 
the controller, otherwise it will throw `IllegalArgumentException`. 
   
   Here is the code  of `JMXConnectorServer. setMBeanServerForwarder()`:
   ```
       public synchronized void setMBeanServerForwarder(MBeanServerForwarder 
mbsf)
       {
           if (mbsf == null)
               throw new IllegalArgumentException("Invalid null argument: 
mbsf");
   
           if (mbeanServer !=  null) mbsf.setMBeanServer(mbeanServer);
           mbeanServer = mbsf;
       }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to