`
network-eagle
  • 浏览: 58051 次
  • 性别: Icon_minigender_1
  • 来自: 重庆
社区版块
存档分类
最新评论

dhcp 和c3po连接配置参数

阅读更多
dbcp:
driverClassName
url
username
password
上面四个分别是驱动,连接字符串,用户名和密码

maxActive 连接池支持的最大连接数
maxIdle 连接池中最多可空闲maxIdle个连接
minIdle 连接池中最少空闲maxIdle个连接
initialSize 初始化连接数目
maxWait 连接池中连接用完时,新的请求等待时间,毫秒
timeBetweenEvictionRunsMillis timeBetweenEvictionRunsMillis和minEvictableIdleTimeMillis一起使用,每

timeBetweenEvictionRunsMillis毫秒秒检查一次连接池中空闲的连接,把空闲时间超过minEvictableIdleTimeMillis毫秒的连接断开,直到连接池中的连接数到minIdle为止

minEvictableIdleTimeMillis 连接池中连接可空闲的时间,毫秒

removeAbandoned true,false,是否清理removeAbandonedTimeout秒没有使用的活动连接,清理后并没有放回连接池
removeAbandonedTimeout 活动连接的最大空闲时间
logAbandoned true,false,连接池收回空闲的活动连接时是否打印消息


minEvictableIdleTimeMillis,removeAbandonedTimeout这两个参数针对的连接对象不一样,minEvictableIdleTimeMillis针对连接池中的连接对象,removeAbandonedTimeout针对未被close的活动连接.

在dbcp使用中遇到的问题:
当短时间之内活动连接达到maxActive,再请求连接,等maxWait秒后连接池就会报出错来:Cannot get a connection, pool exhausted.在这maxWait秒里removeAbandoned并没有起作用,出错后连接池就会把所有的连接断开,为什么这时候removeAbandoned没有起作用呢?


c3p0:
driverClass
jdbcUrl
user
password
minPoolSize
maxPoolSize
initialPoolSize

acquireIncrement 池中没有空闲连接时,一次请求获取的连接数
maxIdleTime 池中连接最大空闲时间
acquireRetryAttempts 获取连接失败后,重新尝试的次数
acquireRetryDelay 尝试连接间隔时间,毫秒
checkoutTimeout 等待连接时间,0为无限等待,毫秒
DebugUnreturnedConnectionStackTraces true,false,是否收回未返回的活动连接
unreturnedConnectionTimeout 活动连接的时间.

c3p0中的问题:
unreturnedConnectionTimeout是给每个活动连接一个时间限制,到点儿就收回,不管有没有正在使用连接.这样不是太好,应该是从最后一次使用连接才开始计时才好.那有没有这样的一个参数从最后一次使用计时呢?
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics