public class HikariCpPlugin extends Object implements IPlugin, IDataSourceProvider
Constructor and Description |
---|
HikariCpPlugin(String jdbcUrl,
String username,
String password) |
HikariCpPlugin(String jdbcUrl,
String username,
String password,
String driverClass) |
Modifier and Type | Method and Description |
---|---|
DataSource |
getDataSource() |
void |
setAutoCommit(boolean autoCommit)
是否自动提交
|
void |
setCatalog(String catalog)
支持 catalog 概念的数据库可以设定该参数
|
void |
setConnectionInitSql(String connectionInitSql)
新连接生成后,添加到连接池前执行的初始化sql
|
void |
setConnectionTestQuery(String connectionTestQuery)
JDBC4以下版本数据库驱动需要设定此参数
|
void |
setConnectionTimeout(long connectionTimeoutMs) |
void |
setDriverClass(String driverClass)
驱动类名
|
void |
setIdleTimeout(long idleTimeoutMs)
空闲超时时间(单位:毫秒),默认600000 (10 分钟)
|
void |
setJdbcUrl(String jdbcUrl)
jdbc连接url
|
void |
setLeakDetectionThreshold(long leakDetectionThresholdMs)
内存泄露侦测周期,最小为2000(2秒)
|
void |
setMaximumPoolSize(int maximumPoolSize)
连接池最大连接数 默认10
|
void |
setMaxLifetime(long maxLifetimeMs)
最大生命周期/最大存活时间(单位:毫秒) ,默认1800000 (30 分钟)
|
void |
setPassword(String password)
数据库密码
|
void |
setPoolName(String poolName)
用户指定的连接池名
|
void |
setReadOnly(boolean readOnly)
是否是只读连接 ,是否有效取决于相应的数据库是否支持
|
void |
setTransactionIsolation(String isolationLevel)
事物等级
|
void |
setUsername(String username)
数据库类型
|
void |
setValidationTimeout(long validationTimeoutMs)
连接是否存活测试周期,默认5000(5秒)
|
boolean |
start() |
boolean |
stop() |
public DataSource getDataSource()
getDataSource
in interface IDataSourceProvider
public final void setDriverClass(String driverClass)
driverClass
- public final void setUsername(String username)
username
- public final void setPassword(String password)
password
- public final void setAutoCommit(boolean autoCommit)
autoCommit
- public final void setReadOnly(boolean readOnly)
readOnly
- public final void setConnectionTimeout(long connectionTimeoutMs)
connectionTimeoutMs
- 连接超时时间(单位:毫秒)public final void setIdleTimeout(long idleTimeoutMs)
idleTimeoutMs
- public final void setMaxLifetime(long maxLifetimeMs)
maxLifetime
- public final void setMaximumPoolSize(int maximumPoolSize)
maximumPoolSize
- public final void setPoolName(String poolName)
poolName
- public final void setConnectionInitSql(String connectionInitSql)
connectionInitSql
- public final void setConnectionTestQuery(String connectionTestQuery)
connectionTestQuery
- 连接时测试sqlpublic final void setJdbcUrl(String jdbcUrl)
jdbcUrl
- public final void setCatalog(String catalog)
catalog
- public final void setTransactionIsolation(String isolationLevel)
isolationLevel
- public final void setValidationTimeout(long validationTimeoutMs)
validationTimeoutMs
- public final void setLeakDetectionThreshold(long leakDetectionThresholdMs)
leakDetectionThresholdMs
- Copyright © 2018. All rights reserved.