问题
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