public abstract class AbstractHikariConfig extends Object implements HikariConfigMBean
Constructor and Description |
---|
AbstractHikariConfig()
Default constructor
|
AbstractHikariConfig(Properties properties)
Construct a HikariConfig from the specified properties object.
|
AbstractHikariConfig(String propertyFileName)
Construct a HikariConfig from the specified property file name.
|
Modifier and Type | Method and Description |
---|---|
void |
addDataSourceProperty(String propertyName,
Object value) |
void |
copyState(AbstractHikariConfig other) |
String |
getCatalog()
Get the default catalog name to be set on connections.
|
IConnectionCustomizer |
getConnectionCustomizer()
Deprecated.
|
String |
getConnectionCustomizerClassName()
Deprecated.
|
String |
getConnectionInitSql()
Deprecated.
|
String |
getConnectionTestQuery()
Get the SQL query to be executed to test the validity of connections.
|
long |
getConnectionTimeout()
Get the maximum number of milliseconds that a client will wait for a connection from the pool.
|
DataSource |
getDataSource()
Get the
DataSource that has been explicitly specified to be wrapped by the
pool. |
String |
getDataSourceClassName() |
String |
getDataSourceJNDI() |
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.
|
String |
getJdbcUrl() |
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 maximum number of connections that HikariCP will keep in the pool,
including both idle and in-use connections.
|
long |
getMaxLifetime()
This property controls the maximum lifetime of a connection in the pool.
|
Object |
getMetricRegistry()
Get the Codahale MetricRegistry, could be null.
|
int |
getMinimumIdle()
The property controls the maximum size that the pool is allowed to reach, including both idle and in-use
connections.
|
String |
getPassword()
Get the default password to use for DataSource.getConnection(username, password) calls.
|
String |
getPoolName()
The name of the connection pool.
|
ThreadFactory |
getThreadFactory()
Get the thread factory used to create threads.
|
String |
getTransactionIsolation() |
String |
getUsername()
Get the default username used for DataSource.getConnection(username, password) calls.
|
long |
getValidationTimeout()
Get the maximum number of milliseconds that the pool will wait for a connection to be validated as
alive.
|
boolean |
isAllowPoolSuspension()
Get the pool suspension behavior (allowed or disallowed).
|
boolean |
isAutoCommit()
Get the default auto-commit behavior of connections in the pool.
|
boolean |
isInitializationFailFast()
Get whether or not the construction of the pool should throw an exception
if the minimum number of connections cannot be created.
|
boolean |
isIsolateInternalQueries() |
boolean |
isJdbc4ConnectionTest()
Deprecated.
|
boolean |
isReadOnly() |
boolean |
isRegisterMbeans() |
void |
setAllowPoolSuspension(boolean isAllowPoolSuspension)
Set whether or not pool suspension is allowed.
|
void |
setAutoCommit(boolean isAutoCommit)
Set the default auto-commit behavior of connections in the pool.
|
void |
setCatalog(String catalog)
Set the default catalog name to be set on connections.
|
void |
setConnectionCustomizer(IConnectionCustomizer customizer)
Deprecated.
|
void |
setConnectionCustomizerClassName(String connectionCustomizerClassName)
Deprecated.
|
void |
setConnectionInitSql(String connectionInitSql)
Deprecated.
|
void |
setConnectionTestQuery(String connectionTestQuery)
Set the SQL query to be executed to test the validity of connections.
|
void |
setConnectionTimeout(long connectionTimeoutMs)
Set the maximum number of milliseconds that a client will wait for a connection from the pool.
|
void |
setDataSource(DataSource dataSource)
Set a
DataSource for the pool to explicitly wrap. |
void |
setDataSourceClassName(String className) |
void |
setDataSourceJNDI(String jndiDataSource) |
void |
setDataSourceProperties(Properties dsProperties) |
void |
setDriverClassName(String driverClassName) |
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)
Set whether or not the construction of the pool should throw an exception
if the minimum number of connections cannot be created.
|
void |
setIsolateInternalQueries(boolean isolate) |
void |
setJdbc4ConnectionTest(boolean useIsValid)
Deprecated.
|
void |
setJdbcUrl(String jdbcUrl) |
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 |
setMetricRegistry(Object metricRegistry)
Set a Codahale MetricRegistry to use for HikariCP.
|
void |
setMinimumIdle(int minIdle)
The property controls the minimum number of idle connections that HikariCP tries to maintain in the pool,
including both idle and in-use connections.
|
void |
setPassword(String password)
Set the default password to use for DataSource.getConnection(username, password) calls.
|
void |
setPoolName(String poolName)
Set the name of the connection pool.
|
void |
setReadOnly(boolean readOnly) |
void |
setRegisterMbeans(boolean register) |
void |
setThreadFactory(ThreadFactory threadFactory)
Set the thread factory to be used to create threads.
|
void |
setTransactionIsolation(String isolationLevel)
Set the default transaction isolation level.
|
void |
setUsername(String username)
Set the default username used for DataSource.getConnection(username, password) calls.
|
void |
setValidationTimeout(long validationTimeoutMs)
Sets the maximum number of milliseconds that the pool will wait for a connection to be validated as
alive.
|
void |
validate() |
public AbstractHikariConfig()
public AbstractHikariConfig(Properties properties)
properties
- the name of the property filepublic AbstractHikariConfig(String propertyFileName)
propertyFileName
will first be treated as a path in the file-system, and if that fails the
ClassLoader.getResourceAsStream(propertyFileName) will be tried.propertyFileName
- the name of the property filepublic String getCatalog()
public void setCatalog(String catalog)
catalog
- the catalog name, or null@Deprecated public String getConnectionCustomizerClassName()
@Deprecated public void setConnectionCustomizerClassName(String connectionCustomizerClassName)
connectionCustomizerClassName
- the name of the customizer class@Deprecated public IConnectionCustomizer getConnectionCustomizer()
@Deprecated public void setConnectionCustomizer(IConnectionCustomizer customizer)
customizer
- an instance of IConnectionCustomizerpublic String getConnectionTestQuery()
public void setConnectionTestQuery(String connectionTestQuery)
Connection.isValid()
method to test connection validity can
be more efficient on some databases and is recommended. See
setJdbc4ConnectionTest(boolean)
.connectionTestQuery
- a SQL query string@Deprecated public String getConnectionInitSql()
@Deprecated public void setConnectionInitSql(String connectionInitSql)
connectionInitSql
- the SQL to execute on new connectionspublic long getConnectionTimeout()
DataSource.getConnection()
.getConnectionTimeout
in interface HikariConfigMBean
public void setConnectionTimeout(long connectionTimeoutMs)
DataSource.getConnection()
.setConnectionTimeout
in interface HikariConfigMBean
connectionTimeoutMs
- the connection timeout in millisecondspublic long getValidationTimeout()
getValidationTimeout
in interface HikariConfigMBean
public void setValidationTimeout(long validationTimeoutMs)
setValidationTimeout
in interface HikariConfigMBean
validationTimeoutMs
- the validation timeout in millisecondspublic DataSource getDataSource()
DataSource
that has been explicitly specified to be wrapped by the
pool.DataSource
instance, or nullpublic void setDataSource(DataSource dataSource)
DataSource
for the pool to explicitly wrap. This setter is not
available through property file based initialization.dataSource
- a specific DataSource
to be wrapped by the poolpublic String getDataSourceClassName()
public void setDataSourceClassName(String className)
public String getDataSourceJNDI()
public void setDataSourceJNDI(String jndiDataSource)
public Properties getDataSourceProperties()
public void setDataSourceProperties(Properties dsProperties)
public void setDriverClassName(String driverClassName)
public long getIdleTimeout()
getIdleTimeout
in interface HikariConfigMBean
public void setIdleTimeout(long idleTimeoutMs)
setIdleTimeout
in interface HikariConfigMBean
idleTimeoutMs
- the idle timeout in millisecondspublic String getJdbcUrl()
public void setJdbcUrl(String jdbcUrl)
public boolean isAutoCommit()
public void setAutoCommit(boolean isAutoCommit)
isAutoCommit
- the desired auto-commit default for connectionspublic boolean isAllowPoolSuspension()
public void setAllowPoolSuspension(boolean isAllowPoolSuspension)
isAllowPoolSuspension
- the desired pool suspension allowancepublic boolean isInitializationFailFast()
public void setInitializationFailFast(boolean failFast)
failFast
- true if the pool should fail if the minimum connections cannot be createdpublic boolean isIsolateInternalQueries()
public void setIsolateInternalQueries(boolean isolate)
@Deprecated public boolean isJdbc4ConnectionTest()
@Deprecated public void setJdbc4ConnectionTest(boolean useIsValid)
public Object getMetricRegistry()
public void setMetricRegistry(Object metricRegistry)
metricRegistry
- the Codahale MetricRegistry to setpublic boolean isReadOnly()
public void setReadOnly(boolean readOnly)
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 long getMaxLifetime()
getMaxLifetime
in interface HikariConfigMBean
public void setMaxLifetime(long maxLifetimeMs)
setMaxLifetime
in interface HikariConfigMBean
maxLifetimeMs
- the maximum connection lifetime in millisecondspublic 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 int getMinimumIdle()
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.
getMinimumIdle
in interface HikariConfigMBean
public void setMinimumIdle(int minIdle)
setMinimumIdle
in interface HikariConfigMBean
minIdle
- the minimum number of idle connections in the pool to maintainpublic String getPassword()
public void setPassword(String password)
password
- the passwordpublic String getPoolName()
getPoolName
in interface HikariConfigMBean
public void setPoolName(String poolName)
poolName
- the name of the connection pool to usepublic String getTransactionIsolation()
public void setTransactionIsolation(String isolationLevel)
Connection
class, eg.
TRANSACTION_REPEATABLE_READ
.isolationLevel
- the name of the isolation levelpublic String getUsername()
public void setUsername(String username)
username
- the usernamepublic ThreadFactory getThreadFactory()
public void setThreadFactory(ThreadFactory threadFactory)
threadFactory
- the thread factory (setting to null causes the default thread factory to be used)public void validate()
public void copyState(AbstractHikariConfig other)
Copyright © 2015 Zaxxer.com. All Rights Reserved.