连接池C3P0日志记录 [英] Connection pool C3P0 logging
问题描述
我有一个使用c3p0作为连接池的Web应用程序。我们使用hibernate作为orm工具。
最近,我们一直在获取连接超时异常。为了调试这些异常,我启用了C3p0的日志记录功能,并在日志中获得了一些信息。任何人都可以帮助我完全理解它。
I have a web application that uses c3p0 as the connection pool. we use hibernate as the orm tool. Recently, we have been getting connection timeout exceptions. To debug these exception, i enabled the logging fro C3p0 and got some information in logs. Can anybody help me in making complete sense out of it.
DEBUG 2012-08-05 14:43:52,590 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] com.mchange.v2.c3p0.stmt.GooGooStatementCache: checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 2; checked out: 0; num connections: 1; num keys: 2
我可以观察到连接池的总大小是2 。检出的连接数是0.是这样吗?并且在上面的num_connections和num键是什么?
from the above, i can observe that the total size of the connection pool is 2. No. of checked out connections are 0. Is this right? And what are num_connections and num keys in the above?
谢谢..
推荐答案
您在引用的日志中看到的是Statement缓存的快照,而不是连接池。在消息被记录时,有两个缓存的PreparedStatements,属于单个Connection。这两个声明都没有被检出/正在使用。
What you are seeing in the bit of log that you've quoted is a snapshot of the Statement cache, not the Connection pool. There were two cached PreparedStatements, which belonged to a single Connection, at the time that message was logged. Neither of the Statements was checked out/in use.
我希望这有助于您!
这篇关于连接池C3P0日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!