Author: kfujino
Date: Tue Nov 29 02:44:58 2016
New Revision: 1771836
URL: http://svn.apache.org/viewvc?rev=1771836&view=rev
Log:
Add the statistics for released connection by an idle check and removeAbandoned.
Modified:
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPoolMBean.java
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/mbeans-descriptors.xml
tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml
Modified:
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
URL:
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1771836&r1=1771835&r2=1771836&view=diff
==============================================================================
---
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
(original)
+++
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
Tue Nov 29 02:44:58 2016
@@ -136,6 +136,8 @@ public class ConnectionPool {
private final AtomicLong createdCount = new AtomicLong(0);
private final AtomicLong releasedCount = new AtomicLong(0);
private final AtomicLong reconnectedCount = new AtomicLong(0);
+ private final AtomicLong removeAbandonedCount = new AtomicLong(0);
+ private final AtomicLong releasedIdleCount = new AtomicLong(0);
//===============================================================================
// PUBLIC METHODS
@@ -559,6 +561,7 @@ public class ConnectionPool {
jmxPool.notify(org.apache.tomcat.jdbc.pool.jmx.ConnectionPool.NOTIFY_ABANDON,
trace);
}
//release the connection
+ removeAbandonedCount.incrementAndGet();
release(con);
} finally {
con.unlock();
@@ -1029,6 +1032,7 @@ public class ConnectionPool {
continue;
long time = con.getTimestamp();
if (shouldReleaseIdle(now, con, time)) {
+ releasedIdleCount.incrementAndGet();
release(con);
idle.remove(con);
setToNull = true;
@@ -1231,6 +1235,22 @@ public class ConnectionPool {
}
/**
+ * The total number of connections released by remove abandoned.
+ * @return the PoolCleaner removed abandoned connection count
+ */
+ public long getRemoveAbandonedCount() {
+ return removeAbandonedCount.get();
+ }
+
+ /**
+ * The total number of connections released by eviction.
+ * @return the PoolCleaner evicted idle connection count
+ */
+ public long getReleasedIdleCount() {
+ return releasedIdleCount.get();
+ }
+
+ /**
* Tread safe wrapper around a future for the regular queue
* This one retrieves the pooled connection object
* and performs the initialization according to
Modified:
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
URL:
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java?rev=1771836&r1=1771835&r2=1771836&view=diff
==============================================================================
---
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
(original)
+++
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
Tue Nov 29 02:44:58 2016
@@ -802,6 +802,29 @@ public class DataSourceProxy implements
}
/**
+ * The total number of connections released by remove abandoned.
+ * @return the PoolCleaner removed abandoned connection count
+ */
+ public long getRemoveAbandonedCount() {
+ try {
+ return createPool().getRemoveAbandonedCount();
+ } catch (SQLException x) {
+ throw new RuntimeException(x);
+ }
+ }
+
+ /**
+ * The total number of connections released by eviction.
+ * @return the PoolCleaner evicted idle connection count
+ */
+ public long getReleasedIdleCount() {
+ try {
+ return createPool().getReleasedIdleCount();
+ } catch (SQLException x) {
+ throw new RuntimeException(x);
+ }
+ }
+ /**
* The total number of connections reconnected by this pool.
* @return the reconnected connection count
*/
Modified:
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java
URL:
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java?rev=1771836&r1=1771835&r2=1771836&view=diff
==============================================================================
---
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java
(original)
+++
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java
Tue Nov 29 02:44:58 2016
@@ -190,6 +190,17 @@ public class ConnectionPool extends Noti
public long getReconnectedCount() {
return pool.getReconnectedCount();
}
+
+ @Override
+ public long getRemoveAbandonedCount() {
+ return pool.getRemoveAbandonedCount();
+ }
+
+ @Override
+ public long getReleasedIdleCount() {
+ return pool.getReleasedIdleCount();
+ }
+
//=================================================================
// POOL OPERATIONS
//=================================================================
Modified:
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPoolMBean.java
URL:
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPoolMBean.java?rev=1771836&r1=1771835&r2=1771836&view=diff
==============================================================================
---
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPoolMBean.java
(original)
+++
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPoolMBean.java
Tue Nov 29 02:44:58 2016
@@ -44,6 +44,11 @@ public interface ConnectionPoolMBean ext
public long getReleasedCount();
public long getReconnectedCount();
+
+ public long getRemoveAbandonedCount();
+
+ public long getReleasedIdleCount();
+
//=================================================================
// POOL OPERATIONS
//=================================================================
Modified:
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/mbeans-descriptors.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/mbeans-descriptors.xml?rev=1771836&r1=1771835&r2=1771836&view=diff
==============================================================================
---
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/mbeans-descriptors.xml
(original)
+++
tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/mbeans-descriptors.xml
Tue Nov 29 02:44:58 2016
@@ -355,7 +355,16 @@
type="java.lang.Long"
writeable="false"/>
- <operation name="checkIdle"
+ <attribute name="removeAbandonedCount"
+ description="The total number of connections released by remove
abandoned."
+ type="java.lang.Long"
+ writeable="false"/>
+
+ <attribute name="releasedIdleCount"
+ description="The total number of connections released by eviction."
+ type="java.lang.Long"
+ writeable="false"/>
+ <operation name="checkIdle"
description="forces a check of idle connections"
impact="ACTION"
returnType="void" />
Modified: tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml?rev=1771836&r1=1771835&r2=1771836&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml Tue Nov 29 02:44:58 2016
@@ -167,8 +167,9 @@
<add>
<bug>58816</bug>: Implement the statistics of jdbc-pool. The stats
infos
are <code>borrowedCount</code>, <code>returnedCount</code>,
- <code>createdCount</code>, <code>releasedCount</code> and
- <code>reconnectedCount</code>. (kfujino)
+ <code>createdCount</code>, <code>releasedCount</code>,
+ <code>reconnectedCount</code>, <code>releasedIdleCount</code> and
+ <code>removeAbandonedCount</code>. (kfujino)
</add>
<fix>
<bug>60194</bug>: If <code>validationQuery</code> is not specified,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]