我在我的 tomcat 容器中使用带有 JNDI 的 Apache DBCP 来汇集到 mysql 数据库的连接。一切正常,但我看到的一个问题是,一旦 pconnection 被汇集,它就永远不会被释放。因此,在负载尖峰连接之后,它们将永远处于休眠状态。他们是通过 context.xml 参数缩小池的方法吗?这是我的配置:
defaultAutoCommit="false"
defaultTransactionIsolation="REPEATABLE_READ"
auth="Container"
type="javax.sql.DataSource"
logAbandoned="true"
removeAbandoned="true"
removeAbandonedTimeout="300"
maxActive="-1"
initialSize="15"
maxIdle="10"
maxWait="10000"
username="user"
password="password"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/mydb"/>