常用数据库连接池 (DBCP、c3p0、Druid) 配置说明 (5)

指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除. 注意: 设置为true后如果要生效,validationQuery参数必须设置为非空字符串(The indication of whether objects will be validated by the idle object evictor (if any). If an object fails to validate, it will be dropped from the pool.)

 

timeBetweenEviction-

RunsMillis

 

-1

 

在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位.如果设置为非正数,则不运行空闲连接回收器线程(The number of milliseconds to sleep between runs of the idle object evictor thread. When non-positive, no idle object evictor thread will be run.)

 

numTestsPerEvictionRun

 

3

 

在每次空闲连接回收器线程(如果有)运行时检查的连接数量(The number of objects to examine during each run of the idle object evictor thread (if any).)

 

minEvictableIdleTime-Millis  

 

1000*60*30

 

连接在池中保持空闲而不被空闲连接回收器线程(如果有)回收的最小时间值,单位毫秒(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).)

 

softMiniEvictableIdle- TimeMillis

 

-1

 

说明(The minimum amount of time a connection may sit idle in the pool before it is eligible for eviction by the idle connection evictor, with the extra condition that at least "minIdle" connections remain in the pool. When miniEvictableIdleTimeMillis is set to a positive value, miniEvictableIdleTimeMillis is examined first by the idle connection evictor - i.e. when idle connections are visited by the evictor, idle time is first compared against miniEvictableIdleTimeMillis (without considering the number of idle connections in the pool) and then against softMinEvictableIdleTimeMillis, including the minIdle constraint.)

 

maxConnLifetimeMillis

 

-1

 

说明(The maximum lifetime in milliseconds of a connection. After this time is exceeded the connection will fail the next activation, passivation or validation test. A value of zero or less means the connection has an infinite lifetime.)

 

logExpiredConnections

 

true

 

说明(Flag to log a message indicating that a connection is being closed by the pool due to maxConnLifetimeMillis exceeded. Set this property to false to suppress expired connection logging that is turned on by default.

 

connectionInitSqls

 

null

 

说明(A Collection of SQL statements that will be used to initialize physical connections when they are first created. These statements are executed only once - when the configured connection factory creates the connection.)

 

info

 

true

 

说明(True means that borrowObject returns the most recently used ("last in") connection in the pool (if there are idle connections available). False means that the pool behaves as a FIFO queue - connections are taken from the idle instance pool in the order that they are returned to the pool.)

 

poolPreparedState-ments

 

false

 

开启池的prepared statement 池功能(Enable prepared statement pooling for this pool.)

 

maxOpenPreparedState-ments  

 

unlimited

 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzyfyz.html