tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kfuj...@apache.org
Subject svn commit: r1822763 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java
Date Wed, 31 Jan 2018 06:12:38 GMT
Author: kfujino
Date: Wed Jan 31 06:12:38 2018
New Revision: 1822763

URL: http://svn.apache.org/viewvc?rev=1822763&view=rev
Log:
use utility 

Modified:
    tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java

Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java?rev=1822763&r1=1822762&r2=1822763&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReportJmx.java
Wed Jan 31 06:12:38 2018
@@ -16,21 +16,15 @@
  */
 package org.apache.tomcat.jdbc.pool.interceptor;
 
-import java.lang.management.ManagementFactory;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
 
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.InstanceNotFoundException;
 import javax.management.ListenerNotFoundException;
-import javax.management.MBeanException;
 import javax.management.MBeanNotificationInfo;
-import javax.management.MBeanRegistrationException;
 import javax.management.MalformedObjectNameException;
-import javax.management.NotCompliantMBeanException;
 import javax.management.Notification;
 import javax.management.NotificationBroadcasterSupport;
 import javax.management.NotificationEmitter;
@@ -48,6 +42,7 @@ import org.apache.juli.logging.LogFactor
 import org.apache.tomcat.jdbc.pool.ConnectionPool;
 import org.apache.tomcat.jdbc.pool.PoolProperties.InterceptorProperty;
 import org.apache.tomcat.jdbc.pool.PooledConnection;
+import org.apache.tomcat.jdbc.pool.jmx.JmxUtil;
 /**
  * Publishes data to JMX and provides notifications
  * when failures happen.
@@ -252,12 +247,8 @@ public class SlowQueryReportJmx extends
         try {
             if (mbeans.remove(poolName)!=null) {
                 ObjectName oname = getObjectName(getClass(),poolName);
-                ManagementFactory.getPlatformMBeanServer().unregisterMBean(oname);
+                JmxUtil.unregisterJmx(oname);
             }
-        } catch (MBeanRegistrationException e) {
-            log.debug("Jmx deregistration failed.",e);
-        } catch (InstanceNotFoundException e) {
-            log.debug("Jmx deregistration failed.",e);
         } catch (MalformedObjectNameException e) {
             log.warn("Jmx deregistration failed.",e);
         } catch (RuntimeOperationsException e) {
@@ -286,7 +277,7 @@ public class SlowQueryReportJmx extends
             } else if (getCompositeType()!=null) {
                 ObjectName oname = getObjectName(getClass(),poolName);
                 if (mbeans.putIfAbsent(poolName, this)==null) {
-                    ManagementFactory.getPlatformMBeanServer().registerMBean(this, oname);
+                    JmxUtil.registerJmx(oname, null, this);
                 }
             } else {
                 log.warn(SlowQueryReport.class.getName()+ "- No JMX support, composite type
was not found.");
@@ -295,12 +286,6 @@ public class SlowQueryReportJmx extends
             log.error("Jmx registration failed, no JMX data will be exposed for the query
stats.",e);
         } catch (RuntimeOperationsException e) {
             log.error("Jmx registration failed, no JMX data will be exposed for the query
stats.",e);
-        } catch (MBeanException e) {
-            log.error("Jmx registration failed, no JMX data will be exposed for the query
stats.",e);
-        } catch (InstanceAlreadyExistsException e) {
-            log.error("Jmx registration failed, no JMX data will be exposed for the query
stats.",e);
-        } catch (NotCompliantMBeanException e) {
-            log.error("Jmx registration failed, no JMX data will be exposed for the query
stats.",e);
         }
     }
 
@@ -313,6 +298,4 @@ public class SlowQueryReportJmx extends
             this.setNotifyPool(Boolean.parseBoolean(p1.getValue()));
         }
     }
-
-
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message