tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kfuj...@apache.org
Subject svn commit: r1822860 - in /tomcat/trunk: modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ webapps/docs/
Date Thu, 01 Feb 2018 08:47:18 GMT
Author: kfujino
Date: Thu Feb  1 08:47:18 2018
New Revision: 1822860

URL: http://svn.apache.org/viewvc?rev=1822860&view=rev
Log:
Add MBean for ResetAbandonedTimer.

Added:
    tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ResetAbandonedTimerMBean.java
  (with props)
Modified:
    tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ResetAbandonedTimer.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ResetAbandonedTimer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ResetAbandonedTimer.java?rev=1822860&r1=1822859&r2=1822860&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ResetAbandonedTimer.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ResetAbandonedTimer.java
Thu Feb  1 08:47:18 2018
@@ -19,8 +19,11 @@ package org.apache.tomcat.jdbc.pool.inte
 
 import java.lang.reflect.Method;
 
+import javax.management.ObjectName;
+
 import org.apache.tomcat.jdbc.pool.ConnectionPool;
 import org.apache.tomcat.jdbc.pool.PooledConnection;
+import org.apache.tomcat.jdbc.pool.jmx.JmxUtil;
 
 /**
  * Class that resets the abandoned timer on any activity on the
@@ -30,10 +33,12 @@ import org.apache.tomcat.jdbc.pool.Poole
  * This is useful for batch processing programs that use connections for extensive amount
of times.
  *
  */
-public class ResetAbandonedTimer extends AbstractQueryReport {
+public class ResetAbandonedTimer extends AbstractQueryReport implements ResetAbandonedTimerMBean
{
 
     private PooledConnection pcon;
 
+    private ObjectName oname = null;
+
     public ResetAbandonedTimer() {
     }
 
@@ -42,11 +47,20 @@ public class ResetAbandonedTimer extends
         super.reset(parent, con);
         if (con == null) {
             this.pcon = null;
+            if (oname != null) {
+                JmxUtil.unregisterJmx(oname);
+                oname = null;
+            }
         } else {
             this.pcon = con;
+            if (oname == null) {
+                String keyprop = ",JdbcInterceptor=" + getClass().getSimpleName();
+                oname = JmxUtil.registerJmx(pcon.getObjectName(), keyprop, this);
+            }
         }
     }
 
+    @Override
     public boolean resetTimer() {
         boolean result = false;
         if (pcon != null) {

Added: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ResetAbandonedTimerMBean.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ResetAbandonedTimerMBean.java?rev=1822860&view=auto
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ResetAbandonedTimerMBean.java
(added)
+++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ResetAbandonedTimerMBean.java
Thu Feb  1 08:47:18 2018
@@ -0,0 +1,22 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.tomcat.jdbc.pool.interceptor;
+
+public interface ResetAbandonedTimerMBean {
+    public boolean resetTimer();
+}

Propchange: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ResetAbandonedTimerMBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1822860&r1=1822859&r2=1822860&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Feb  1 08:47:18 2018
@@ -176,6 +176,9 @@
         Expose the cache size for each connection via JMX in
         <code>StatementCache</code>. (kfujino)
       </add>
+      <add>
+        Add MBean for <code>ResetAbandonedTimer</code>. (kfujino)
+      </add>
     </changelog>
   </subsection>
 </section>



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


Mime
View raw message