In the java DBCP connection pool - what is an idle connection?

人走茶凉 提交于 2019-12-13 14:10:13

问题


A colleague at work insists that a DBCP idle connection is a connection that has lain unused for 30 minutes.

I believe a dbcp idle connection is a connection that is in the pool available to be borrowed, and an active connection is one that is borrowed.

Looking through the code I found no reference to 30 minutes or other magic values and a cursory glance through the code for assuring minidle does not show any such logic.

If he is correct can you please back that up with a code or documentation reference. For the complete answer I would like it answered for both DBCP 1.1 and 1.6.


回答1:


http://commons.apache.org/proper/commons-dbcp/configuration.html

minEvictableIdleTimeMillis is set to exactly 30 minutes by default and it's the

minimum amount of time an object may sit idle in the pool before it is eligable for eviction by the idle object evictor (if any).

Reading the entire configuration page doesn't 100% explicitly say that you're correct and your colleague is wrong but I still think you'll agree when you read it. :)



来源:https://stackoverflow.com/questions/25396624/in-the-java-dbcp-connection-pool-what-is-an-idle-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!