JBOSS AS 7.1.1. 最终关闭泄漏的连接? [英] JBOSS AS 7.1.1.Final Closing Leaked Connections?
问题描述
我已经在standalone.xml中做了如下设置:
I have already done the following settings in standalone.xml as:
<datasource jta="true" jndi-name="java:jboss/datasources/myDS" pool-name="java:jboss/datasources/myDS" enabled="true" use-ccm="true">
<cached-connection-manager debug="true" error="true"/>
因此,我也收到诸如为您关闭连接"之类的消息:
Therefore, I am also getting the messages like "Closing a connection for you" as:
INFO [org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager] (http--0.0.0.0-8080-160) IJ000100: Closing a connection for you. Please close them yourself: org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6@5cdb81dc: java.lang.Throwable: STACKTRACE
at org.jboss.jca.core.connectionmanager.ccm.CachedConnectionManagerImpl.registerConnection(CachedConnectionManagerImpl.java:265)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:495)
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:129)
不过,有时我的游泳池会耗尽.它用完了超过 200 个定义的连接.为什么?
Still, Sometimes my pool gets exhausted. It runs out of connections beyond 200 as defined. Why?
<min-pool-size>30</min-pool-size>
<max-pool-size>200</max-pool-size>
不可能,我的应用程序需要这么多连接.肯定有连接泄漏.如果是这样,当我启用上述设置时,为什么 jboss 没有自行关闭它:
There is no way, that my application needs these much connections. There is surely a connection leakage. And If it is, Why jboss is not closing it by it's own when I have enabled the setting as i said above:
<datasource jta="true" jndi-name="java:jboss/datasources/myDS" pool-name="java:jboss/datasources/myDS" enabled="true" use-ccm="true">
<cached-connection-manager debug="true" error="true"/>
如何解决?
谢谢.
推荐答案
JBoss 无法关闭所有泄漏的连接.
JBoss can not close all leaked connection.
您需要在启用 JCA 日志记录后通过检查日志来查找泄漏的连接.我通过这种方式解决了连接泄漏.
You need to find leaked connection by checking logs after enabling JCA logging. I resolved connection leak by this way.
<logger category="org.jboss.jca">
<level name="DEBUG"/>
</logger>
您将在日志中获得如下条目
You will get entries like below in logs
DEBUG [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (MSC 服务线程 1-4) {JNDI_NAME}: getConnection(null, null) [1/100] -->
这意味着从池中获取连接.
DEBUG [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (MSC 服务线程 1-4) {JNDI_NAME}: returnConnection(607e334, false) [1/99]
--> 表示返回连接池
您可以检查哪个查询未将连接返回到池,并从执行该查询的位置检查您的应用程序.修复它.
You can check which query is not returning connetion to pool and check your application from where that query is being executed. Fix it.
这篇关于JBOSS AS 7.1.1. 最终关闭泄漏的连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!