From: fhanik Date: Fri, 30 Jan 2009 23:32:38 +0000 (+0000) Subject: fix sizing issue when db is restarted X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=be780d78c755784653e5e908c77727164d508eb1;p=tomcat7.0 fix sizing issue when db is restarted fix JMX domain name fix exception handling git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@739449 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java index 9ef02005b..3009d5245 100644 --- a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java +++ b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java @@ -48,7 +48,7 @@ import org.apache.juli.logging.LogFactory; */ public class ConnectionPool { - public static final String POOL_JMX_TYPE_PREFIX = "org.apache.tomcat.jdbc.pool.jmx:type="; + public static final String POOL_JMX_TYPE_PREFIX = "tomcat.jdbc:type="; //logger protected static Log log = LogFactory.getLog(ConnectionPool.class); @@ -84,11 +84,6 @@ public class ConnectionPool { protected boolean closed = false; /** - * Size of the pool - */ - protected AtomicInteger size = new AtomicInteger(0); - - /** * Since newProxyInstance performs the same operation, over and over * again, it is much more optimized if we simply store the constructor ourselves. */ @@ -285,7 +280,6 @@ public class ConnectionPool { } if (pool.size()==0 && force && pool!=busy) pool = busy; } - size.set(0); if (this.getPoolProperties().isJmxEnabled()) stopJmx(); PoolProperties.InterceptorDefinition[] proxies = getPoolProperties().getJdbcInterceptorsAsArray(); for (int i=0; i=poolProperties.getMaxIdle()) || (!idle.offer(con))) { if (log.isDebugEnabled()) { - log.debug("Connection ["+con+"] will be closed and not returned to the pool, idle.offer failed."); + log.debug("Connection ["+con+"] will be closed and not returned to the pool, idle["+idle.size()+"]>=maxIdle["+poolProperties.getMaxIdle()+"] idle.offer failed."); } release(con); } @@ -757,7 +753,7 @@ public class ConnectionPool { } protected void finalize(PooledConnection con) { - size.addAndGet(-1); + } protected void startJmx() { diff --git a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java index 0841c5261..215878b91 100644 --- a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java +++ b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java @@ -19,6 +19,7 @@ package org.apache.tomcat.jdbc.pool; import java.io.ByteArrayInputStream; import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.sql.Connection; @@ -439,7 +440,11 @@ public class DataSourceFactory implements ObjectFactory { m = datasource.getClass().getMethod(method.getName(), method.getParameterTypes()); methods.put(method, m); } - return m.invoke(datasource, args); + try { + return m.invoke(datasource, args); + }catch (InvocationTargetException t) { + throw t.getTargetException(); + } } } diff --git a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/mbeans-descriptors.xml b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/mbeans-descriptors.xml index 0869b61fe..e312d053b 100644 --- a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/mbeans-descriptors.xml +++ b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/mbeans-descriptors.xml @@ -17,7 +17,7 @@ --> -