简体   繁体   中英

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

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.

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. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM