You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2021/07/09 14:43:00 UTC

[GitHub] [logging-log4j2] garydgregory commented on a change in pull request #547: LOG4J2-3121: log4j2 config modified at run-time may trigger incomplete MBean re-initialization due to InstanceAlreadyExistsException

garydgregory commented on a change in pull request #547:
URL: https://github.com/apache/logging-log4j2/pull/547#discussion_r667002497



##########
File path: log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
##########
@@ -389,7 +389,15 @@ private static void registerAppenders(final LoggerContext ctx, final MBeanServer
 
     private static void register(final MBeanServer mbs, final Object mbean, final ObjectName objectName)
             throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
+        if (mbs.isRegistered(objectName)) {
+            try {
+                mbs.unregisterMBean(objectName);
+            } catch (MBeanRegistrationException | InstanceNotFoundException _ex) {
+                LOGGER.trace("Failed to unregister MBean {}", objectName);

Review comment:
       No underscores please, _ex -> ex




-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org