public class HikariConfig extends java.lang.Object implements HikariConfigMBean
| Constructor and Description |
|---|
HikariConfig()
Default constructor
|
HikariConfig(java.util.Properties properties)
Construct a HikariConfig from the specified properties object.
|
HikariConfig(java.lang.String propertyFileName)
Construct a HikariConfig from the specified property file name.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDataSourceProperty(java.lang.String propertyName,
java.lang.Object value) |
java.lang.String |
getCatalog()
Get the default catalog name to be set on connections.
|
IConnectionCustomizer |
getConnectionCustomizer()
Get the customizer instance specified by the user.
|
java.lang.String |
getConnectionCustomizerClassName()
Get the name of the connection customizer class to instantiate and execute
on all new connections.
|
java.lang.String |
getConnectionInitSql()
Get the SQL string that will be executed on all new connections when they are
created, before they are added to the pool.
|
java.lang.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.
|
javax.sql.DataSource |
getDataSource()
Get the
DataSource that has been explicitly specified to be wrapped by the
pool. |
java.lang.String |
getDataSourceClassName() |
java.lang.String |
getDataSourceJNDI() |
java.util.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.
|
java.lang.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.
|
java.lang.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.
|
java.lang.String |
getPassword()
Get the default password to use for DataSource.getConnection(username, password) calls.
|
java.lang.String |
getPoolName()
The name of the connection pool.
|
java.util.concurrent.ThreadFactory |
getThreadFactory()
Get the thread factory used to create threads.
|
java.lang.String |
getTransactionIsolation() |
java.lang.String |
getUsername()
Get the default username used for DataSource.getConnection(username, password) calls.
|
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 |
setAutoCommit(boolean isAutoCommit)
Set the default auto-commit behavior of connections in the pool.
|
void |
setCatalog(java.lang.String catalog)
Set the default catalog name to be set on connections.
|
void |
setConnectionCustomizer(IConnectionCustomizer customizer)
Set the connection customizer to be used by the pool.
|
void |
setConnectionCustomizerClassName(java.lang.String connectionCustomizerClassName)
Set the name of the connection customizer class to instantiate and execute
on all new connections.
|
void |
setConnectionInitSql(java.lang.String connectionInitSql)
Set the SQL string that will be executed on all new connections when they are
created, before they are added to the pool.
|
void |
setConnectionTestQuery(java.lang.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(javax.sql.DataSource dataSource)
Set a
DataSource for the pool to explicitly wrap. |
void |
setDataSourceClassName(java.lang.String className) |
void |
setDataSourceJNDI(java.lang.String jndiDataSource) |
void |
setDataSourceProperties(java.util.Properties dsProperties) |
void |
setDriverClassName(java.lang.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(java.lang.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(java.lang.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(java.lang.String password)
Set the default password to use for DataSource.getConnection(username, password) calls.
|
void |
setPoolName(java.lang.String poolName)
Set the name of the connection pool.
|
void |
setReadOnly(boolean readOnly) |
void |
setRegisterMbeans(boolean register) |
void |
setThreadFactory(java.util.concurrent.ThreadFactory threadFactory)
Set the thread factory to be used to create threads.
|
void |
setTransactionIsolation(java.lang.String isolationLevel)
Set the default transaction isolation level.
|
void |
setUsername(java.lang.String username)
Set the default username used for DataSource.getConnection(username, password) calls.
|
void |
validate() |
public HikariConfig()
public HikariConfig(java.util.Properties properties)
properties - the name of the property filepublic HikariConfig(java.lang.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 java.lang.String getCatalog()
public void setCatalog(java.lang.String catalog)
catalog - the catalog name, or nullpublic java.lang.String getConnectionCustomizerClassName()
public void setConnectionCustomizerClassName(java.lang.String connectionCustomizerClassName)
connectionCustomizerClassName - the name of the customizer classpublic IConnectionCustomizer getConnectionCustomizer()
public void setConnectionCustomizer(IConnectionCustomizer customizer)
customizer - an instance of IConnectionCustomizerpublic java.lang.String getConnectionTestQuery()
public void setConnectionTestQuery(java.lang.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 stringpublic java.lang.String getConnectionInitSql()
public void setConnectionInitSql(java.lang.String connectionInitSql)
connectionInitSql - the SQL to execute on new connectionspublic long getConnectionTimeout()
DataSource.getConnection().getConnectionTimeout in interface HikariConfigMBeanpublic void setConnectionTimeout(long connectionTimeoutMs)
DataSource.getConnection().setConnectionTimeout in interface HikariConfigMBeanconnectionTimeoutMs - the connection timeout in millisecondspublic javax.sql.DataSource getDataSource()
DataSource that has been explicitly specified to be wrapped by the
pool.DataSource instance, or nullpublic void setDataSource(javax.sql.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 java.lang.String getDataSourceClassName()
public void setDataSourceClassName(java.lang.String className)
public void addDataSourceProperty(java.lang.String propertyName,
java.lang.Object value)
public java.lang.String getDataSourceJNDI()
public void setDataSourceJNDI(java.lang.String jndiDataSource)
public java.util.Properties getDataSourceProperties()
public void setDataSourceProperties(java.util.Properties dsProperties)
public void setDriverClassName(java.lang.String driverClassName)
public long getIdleTimeout()
getIdleTimeout in interface HikariConfigMBeanpublic void setIdleTimeout(long idleTimeoutMs)
setIdleTimeout in interface HikariConfigMBeanidleTimeoutMs - the idle timeout in millisecondspublic java.lang.String getJdbcUrl()
public void setJdbcUrl(java.lang.String jdbcUrl)
public boolean isAutoCommit()
public void setAutoCommit(boolean isAutoCommit)
isAutoCommit - the desired auto-commit default for connectionspublic 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 java.lang.Object getMetricRegistry()
public void setMetricRegistry(java.lang.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 HikariConfigMBeanpublic void setLeakDetectionThreshold(long leakDetectionThresholdMs)
setLeakDetectionThreshold in interface HikariConfigMBeanleakDetectionThresholdMs - the connection leak detection threshold in millisecondspublic long getMaxLifetime()
getMaxLifetime in interface HikariConfigMBeanpublic void setMaxLifetime(long maxLifetimeMs)
setMaxLifetime in interface HikariConfigMBeanmaxLifetimeMs - the maximum connection lifetime in millisecondspublic int getMaximumPoolSize()
getMaximumPoolSize in interface HikariConfigMBeanpublic 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 HikariConfigMBeanmaxPoolSize - 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 HikariConfigMBeanpublic void setMinimumIdle(int minIdle)
setMinimumIdle in interface HikariConfigMBeanminIdle - the minimum number of idle connections in the pool to maintainpublic java.lang.String getPassword()
public void setPassword(java.lang.String password)
password - the passwordpublic java.lang.String getPoolName()
getPoolName in interface HikariConfigMBeanpublic void setPoolName(java.lang.String poolName)
poolName - the name of the connection pool to usepublic java.lang.String getTransactionIsolation()
public void setTransactionIsolation(java.lang.String isolationLevel)
Connection class, eg.
TRANSACTION_REPEATABLE_READ.isolationLevel - the name of the isolation levelpublic java.lang.String getUsername()
public void setUsername(java.lang.String username)
username - the usernamepublic java.util.concurrent.ThreadFactory getThreadFactory()
public void setThreadFactory(java.util.concurrent.ThreadFactory threadFactory)
threadFactory - the thread factory (setting to null causes the default thread factory to be used)public void validate()
Copyright © 2014 Zaxxer.com. All Rights Reserved.