public class DataSourceConfiguration
extends java.lang.Object
说明:DataSourceConfiguration 类是线程安全的,可在多个线程中使用同一个实例。
| 构造器和说明 |
|---|
DataSourceConfiguration(int poolSize,
long checkoutTimeout,
int maxOccupyTime,
int timeout,
int slowExecutionThreshold)
构造一个 Mysql 数据库连接池使用的配置信息,如果最大连接数量值小于最小连接数量值,将使用最小连接数量的值。
|
| 限定符和类型 | 方法和说明 |
|---|---|
long |
getCheckoutTimeout()
获得从连接池获取数据库连接的超时时间,单位:毫秒,如果等于 0,则没有超时时间限制。
|
int |
getMaxOccupyTime()
获得连接最大占用时间,单位:毫秒,如果为 0,则没有最大时间限制。
|
int |
getPoolSize()
获得连接池拥有的数据库连接数量,不允许小于等于 0。
|
int |
getSlowExecutionThreshold()
获得执行 Mysql 命令过慢最小时间,单位:毫秒。
|
int |
getTimeout()
获得 SQL 执行超时时间,单位:毫秒,如果等于 0,则没有超时时间限制。
|
java.lang.String |
toString() |
public DataSourceConfiguration(int poolSize,
long checkoutTimeout,
int maxOccupyTime,
int timeout,
int slowExecutionThreshold)
throws java.lang.IllegalArgumentException
poolSize - 连接池拥有的数据库连接数量,不允许小于等于 0checkoutTimeout - 从连接池获取数据库连接的超时时间,单位:毫秒,如果等于 0,则没有超时时间限制,不允许设置小于 0 的值maxOccupyTime - 连接最大占用时间,单位:毫秒,如果为 0,则没有最大时间限制,不允许设置小于 0 的值timeout - SQL 执行超时时间,单位:毫秒,如果等于 0,则没有超时时间限制,不允许设置小于 0 的值slowExecutionThreshold - 执行 Mysql 命令过慢最小时间,单位:毫秒,不能小于等于 0java.lang.IllegalArgumentException - 如果 minPoolSize 或 maxPoolSize 或 checkoutTimeout 的值小于 0,将抛出此异常public int getPoolSize()
public long getCheckoutTimeout()
public int getMaxOccupyTime()
public int getTimeout()
public int getSlowExecutionThreshold()
public java.lang.String toString()
toString 在类中 java.lang.ObjectCopyright © 2019. All Rights Reserved.