在Java DBCP连接池中-什么是空闲连接? [英] In the java DBCP connection pool - what is an idle connection?

查看:539
本文介绍了在Java DBCP连接池中-什么是空闲连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个工作中的同事坚持认为DBCP空闲连接是30分钟未使用的连接。

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

我相信dbcp空闲连接是池中可以借用的连接,活动连接是借用的连接。

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.

浏览代码时,我发现没有引用30分钟或其他魔术值,并且粗略浏览代码以确保minidle并没有显示任何此类逻辑。

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.

如果他是正确的人,请提供代码或文档参考作为备份。对于完整的答案,我希望它对DBCP 1.1和1.6都可以回答。

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 默认设置为正好30分钟,这是

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

读取整个配置网页没有100%明确表示您是正确的,而您的同事是错误的,但我仍然认为您在阅读该书时会同意。 :)

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

这篇关于在Java DBCP连接池中-什么是空闲连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆