public class HikariConfig extends Object implements HikariConfigMBean
Constructor and Description |
---|
HikariConfig()
Default constructor
|
HikariConfig(Properties properties)
Construct a HikariConfig from the specified properties object.
|
HikariConfig(String propertyFileName)
Construct a HikariConfig from the specified property file name.
|
Modifier and Type | Method and Description |
---|---|
void |
addDataSourceProperty(String propertyName,
Object value) |
int |
getAcquireIncrement()
This property controls the maximum number of connections that are acquired at one time,
with the exception of pool initialization.
|
int |
getAcquireRetries()
This is a per-connection attempt retry count used during new connection creation (acquisition).
|
long |
getAcquireRetryDelay()
This property controls the number of milliseconds to delay between attempts to acquire a connection
to the database.
|
String |
getCatalog() |
String |
getConnectionCustomizerClassName() |
String |
getConnectionInitSql() |
String |
getConnectionTestQuery() |
long |
getConnectionTimeout()
This is for "legacy" databases that do not support the JDBC4
Connection.isValid() API. |
DataSource |
getDataSource() |
String |
getDataSourceClassName() |
Properties |
getDataSourceProperties() |
long |
getIdleTimeout()
This property controls the maximum amount of time (in milliseconds) that a connection is allowed to sit
idle in the pool.
|
long |
getLeakDetectionThreshold()
This property controls the amount of time that a connection can be out of the pool before a message is
logged indicating a possible connection leak.
|
int |
getMaximumPoolSize()
The property controls the minimum number of connections that HikariCP tries to maintain in the pool,
including both idle and in-use connections.
|
long |
getMaxLifetime()
This property controls the maximum lifetime of a connection in the pool.
|
int |
getMinimumPoolSize()
The property controls the maximum size that the pool is allowed to reach, including both idle and in-use
connections.
|
String |
getPoolName()
The name of the connection pool.
|
int |
getTransactionIsolation() |
boolean |
isAutoCommit() |
boolean |
isInitializationFailFast() |
boolean |
isJdbc4ConnectionTest() |
boolean |
isRegisterMbeans() |
void |
setAcquireIncrement(int acquireIncrement)
This property controls the maximum number of connections that are acquired at one time,
with the exception of pool initialization.
|
void |
setAcquireRetries(int acquireRetries)
This is a per-connection attempt retry count used during new connection creation (acquisition).
|
void |
setAcquireRetryDelay(long acquireRetryDelayMs)
This property controls the number of milliseconds to delay between attempts to acquire a connection
to the database.
|
void |
setAutoCommit(boolean isAutoCommit) |
void |
setCatalog(String catalog) |
void |
setConnectionCustomizerClassName(String connectionCustomizerClassName) |
void |
setConnectionInitSql(String connectionInitSql) |
void |
setConnectionTestQuery(String connectionTestQuery) |
void |
setConnectionTimeout(long connectionTimeoutMs)
This is for "legacy" databases that do not support the JDBC4 {code Connection.isValid()} API.
|
void |
setDataSource(DataSource dataSource) |
void |
setDataSourceClassName(String className) |
void |
setDataSourceProperties(Properties dsProperties) |
void |
setIdleTimeout(long idleTimeoutMs)
This property controls the maximum amount of time (in milliseconds) that a connection is allowed to sit
idle in the pool.
|
void |
setInitializationFailFast(boolean failFast) |
void |
setJdbc4ConnectionTest(boolean useIsValid) |
void |
setLeakDetectionThreshold(long leakDetectionThresholdMs)
This property controls the amount of time that a connection can be out of the pool before a message is
logged indicating a possible connection leak.
|
void |
setMaximumPoolSize(int maxPoolSize)
The property controls the maximum size that the pool is allowed to reach, including both idle and in-use
connections.
|
void |
setMaxLifetime(long maxLifetimeMs)
This property controls the maximum lifetime of a connection in the pool.
|
void |
setMinimumPoolSize(int minPoolSize)
The property controls the minimum number of connections that HikariCP tries to maintain in the pool,
including both idle and in-use connections.
|
void |
setPoolName(String poolName)
Set the name of the connection pool.
|
void |
setRegisterMbeans(boolean register) |
void |
setTransactionIsolation(String isolationLevel)
Set the default transaction isolation level.
|
void |
setUseInstrumentation(boolean useInstrumentation) |
void |
validate() |
public HikariConfig()
public HikariConfig(Properties properties)
properties
- the name of the property filepublic HikariConfig(String propertyFileName)
propertyFileName
- the name of the property filepublic int getAcquireIncrement()
getAcquireIncrement
in interface HikariConfigMBean
public void setAcquireIncrement(int acquireIncrement)
setAcquireIncrement
in interface HikariConfigMBean
acquireIncrement
- the acquire incrementpublic int getAcquireRetries()
HikariConfigMBean.getAcquireRetryDelay()
milliseconds
followed by another attempt, up to the number of retries configured by this property.getAcquireRetries
in interface HikariConfigMBean
public void setAcquireRetries(int acquireRetries)
HikariConfigMBean.setAcquireRetryDelay(long)
milliseconds
followed by another attempt, up to the number of retries configured by this property.setAcquireRetries
in interface HikariConfigMBean
acquireRetries
- the acquire retry countpublic long getAcquireRetryDelay()
getAcquireRetryDelay
in interface HikariConfigMBean
public void setAcquireRetryDelay(long acquireRetryDelayMs)
setAcquireRetryDelay
in interface HikariConfigMBean
acquireRetryDelayMs
- the acquire retry delay in millisecondspublic String getCatalog()
public void setCatalog(String catalog)
public String getConnectionCustomizerClassName()
public void setConnectionCustomizerClassName(String connectionCustomizerClassName)
public String getConnectionTestQuery()
public void setConnectionTestQuery(String connectionTestQuery)
public String getConnectionInitSql()
public void setConnectionInitSql(String connectionInitSql)
public long getConnectionTimeout()
Connection.isValid()
API. This is the
query that will be executed just before a connection is given to you from the pool to validate that
the connection to the database is still alive. It is database dependent and should be a query that
takes very little processing by the database (eg. "VALUES 1"). See the {code getJdbc4ConnectionTest()} property
for a more efficent alive test. One of either this property or jdbc4ConnectionTest must be specified.getConnectionTimeout
in interface HikariConfigMBean
public void setConnectionTimeout(long connectionTimeoutMs)
setJdbc4ConnectionTest()
property
for a more efficent alive test. One of either this property or jdbc4ConnectionTest must be specified.setConnectionTimeout
in interface HikariConfigMBean
connectionTimeoutMs
- the connection timeout in millisecondspublic DataSource getDataSource()
public void setDataSource(DataSource dataSource)
public String getDataSourceClassName()
public void setDataSourceClassName(String className)
public Properties getDataSourceProperties()
public void setDataSourceProperties(Properties dsProperties)
public long getIdleTimeout()
getIdleTimeout
in interface HikariConfigMBean
public void setIdleTimeout(long idleTimeoutMs)
setIdleTimeout
in interface HikariConfigMBean
idleTimeoutMs
- the idle timeout in millisecondspublic boolean isAutoCommit()
public void setAutoCommit(boolean isAutoCommit)
public boolean isInitializationFailFast()
public void setInitializationFailFast(boolean failFast)
public boolean isJdbc4ConnectionTest()
public void setJdbc4ConnectionTest(boolean useIsValid)
public boolean isRegisterMbeans()
public void setRegisterMbeans(boolean register)
public long getLeakDetectionThreshold()
getLeakDetectionThreshold
in interface HikariConfigMBean
public void setLeakDetectionThreshold(long leakDetectionThresholdMs)
setLeakDetectionThreshold
in interface HikariConfigMBean
leakDetectionThresholdMs
- the connection leak detection threshold in millisecondspublic void setUseInstrumentation(boolean useInstrumentation)
public long getMaxLifetime()
getMaxLifetime
in interface HikariConfigMBean
public void setMaxLifetime(long maxLifetimeMs)
setMaxLifetime
in interface HikariConfigMBean
maxLifetimeMs
- the maximum connection lifetime in millisecondspublic int getMinimumPoolSize()
When the pool reaches this size, and no idle connections are available, calls to getConnection() will block for up to connectionTimeout milliseconds before timing out.
getMinimumPoolSize
in interface HikariConfigMBean
public void setMinimumPoolSize(int minPoolSize)
setMinimumPoolSize
in interface HikariConfigMBean
minPoolSize
- the minimum number of connections in the poolpublic int getMaximumPoolSize()
getMaximumPoolSize
in interface HikariConfigMBean
public void setMaximumPoolSize(int maxPoolSize)
When the pool reaches this size, and no idle connections are available, calls to getConnection() will block for up to connectionTimeout milliseconds before timing out.
setMaximumPoolSize
in interface HikariConfigMBean
maxPoolSize
- the maximum number of connections in the poolpublic String getPoolName()
getPoolName
in interface HikariConfigMBean
public void setPoolName(String poolName)
poolName
- the name of the connection pool to usepublic int getTransactionIsolation()
public void setTransactionIsolation(String isolationLevel)
Connection
class, eg.
TRANSACTION_REPEATABLE_READ
.isolationLevel
- the name of the isolation levelpublic void validate()
Copyright © 2014 Zaxxer.com. All rights reserved.