public class HikariDataSource extends HikariConfig implements javax.sql.DataSource, java.io.Closeable
| Constructor and Description |
|---|
HikariDataSource()
Default constructor.
|
HikariDataSource(HikariConfig configuration)
Construct a HikariDataSource with the specified configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Shutdown the DataSource and its associated pool.
|
void |
evictConnection(java.sql.Connection connection)
Evict a connection from the pool.
|
java.sql.Connection |
getConnection() |
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password) |
HikariConfigMXBean |
getHikariConfigMXBean()
Get the
HikariConfigMXBean for this HikariDataSource instance. |
HikariPoolMXBean |
getHikariPoolMXBean()
Get the
HikariPoolMXBean for this HikariDataSource instance. |
int |
getLoginTimeout() |
java.io.PrintWriter |
getLogWriter() |
java.util.logging.Logger |
getParentLogger() |
boolean |
isClosed()
Determine whether the HikariDataSource has been closed.
|
boolean |
isWrapperFor(java.lang.Class<?> iface) |
void |
resumePool()
Deprecated.
Call the
HikariPoolMXBean#resumePool() method on the HikariPoolMXBean
obtained by #getHikariPoolMXBean() or JMX lookup. |
void |
setHealthCheckRegistry(java.lang.Object healthCheckRegistry)
Set the HealthCheckRegistry that will be used for registration of health checks by HikariCP.
|
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(java.io.PrintWriter out) |
void |
setMetricRegistry(java.lang.Object metricRegistry)
Set a MetricRegistry instance to use for registration of metrics used by HikariCP.
|
void |
setMetricsTrackerFactory(MetricsTrackerFactory metricsTrackerFactory) |
void |
shutdown()
Deprecated.
This method has been deprecated, please use
close() instead |
void |
suspendPool()
Deprecated.
Call the
HikariPoolMXBean#suspendPool() method on the HikariPoolMXBean
obtained by #getHikariPoolMXBean() or JMX lookup. |
java.lang.String |
toString() |
<T> T |
unwrap(java.lang.Class<T> iface) |
addDataSourceProperty, addHealthCheckProperty, copyState, copyStateTo, getCatalog, getConnectionInitSql, getConnectionTestQuery, getConnectionTimeout, getDataSource, getDataSourceClassName, getDataSourceJNDI, getDataSourceProperties, getDriverClassName, getHealthCheckProperties, getHealthCheckRegistry, getIdleTimeout, getInitializationFailTimeout, getJdbcUrl, getLeakDetectionThreshold, getMaximumPoolSize, getMaxLifetime, getMetricRegistry, getMetricsTrackerFactory, getMinimumIdle, getPassword, getPoolName, getScheduledExecutor, getScheduledExecutorService, getSchema, getThreadFactory, getTransactionIsolation, getUsername, getValidationTimeout, isAllowPoolSuspension, isAutoCommit, isInitializationFailFast, isIsolateInternalQueries, isJdbc4ConnectionTest, isReadOnly, isRegisterMbeans, setAllowPoolSuspension, setAutoCommit, setCatalog, setConnectionInitSql, setConnectionTestQuery, setConnectionTimeout, setDataSource, setDataSourceClassName, setDataSourceJNDI, setDataSourceProperties, setDriverClassName, setHealthCheckProperties, setIdleTimeout, setInitializationFailFast, setInitializationFailTimeout, setIsolateInternalQueries, setJdbc4ConnectionTest, setJdbcUrl, setLeakDetectionThreshold, setMaximumPoolSize, setMaxLifetime, setMinimumIdle, setPassword, setPoolName, setReadOnly, setRegisterMbeans, setScheduledExecutor, setScheduledExecutorService, setSchema, setThreadFactory, setTransactionIsolation, setUsername, setValidationTimeout, validatepublic HikariDataSource()
HikariDataSource(HikariConfig) will
result in getConnection() performance that is slightly lower
due to lazy initialization checks.public HikariDataSource(HikariConfig configuration)
configuration - a HikariConfig instancepublic java.sql.Connection getConnection()
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptionpublic java.sql.Connection getConnection(java.lang.String username,
java.lang.String password)
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptionpublic java.io.PrintWriter getLogWriter()
throws java.sql.SQLException
getLogWriter in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic void setLogWriter(java.io.PrintWriter out)
throws java.sql.SQLException
setLogWriter in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic void setLoginTimeout(int seconds)
throws java.sql.SQLException
setLoginTimeout in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic int getLoginTimeout()
throws java.sql.SQLException
getLoginTimeout in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic java.util.logging.Logger getParentLogger()
throws java.sql.SQLFeatureNotSupportedException
getParentLogger in interface javax.sql.CommonDataSourcejava.sql.SQLFeatureNotSupportedExceptionpublic <T> T unwrap(java.lang.Class<T> iface)
throws java.sql.SQLException
unwrap in interface java.sql.Wrapperjava.sql.SQLExceptionpublic boolean isWrapperFor(java.lang.Class<?> iface)
throws java.sql.SQLException
isWrapperFor in interface java.sql.Wrapperjava.sql.SQLExceptionpublic void setMetricRegistry(java.lang.Object metricRegistry)
setMetricRegistry in class HikariConfigmetricRegistry - the MetricRegistry instance to usepublic void setMetricsTrackerFactory(MetricsTrackerFactory metricsTrackerFactory)
setMetricsTrackerFactory in class HikariConfigpublic void setHealthCheckRegistry(java.lang.Object healthCheckRegistry)
null.setHealthCheckRegistry in class HikariConfighealthCheckRegistry - the HealthCheckRegistry to be usedpublic HikariPoolMXBean getHikariPoolMXBean()
HikariPoolMXBean for this HikariDataSource instance. If this method is called on
a HikariDataSource that has been constructed without a HikariConfig instance,
and before an initial call to #getConnection(), the return value will be null.HikariPoolMXBean instance, or null.public HikariConfigMXBean getHikariConfigMXBean()
HikariConfigMXBean for this HikariDataSource instance.HikariConfigMXBean instance.public void evictConnection(java.sql.Connection connection)
connection - the connection to evict from the pool@Deprecated public void suspendPool()
HikariPoolMXBean#suspendPool() method on the HikariPoolMXBean
obtained by #getHikariPoolMXBean() or JMX lookup.getConnection()
will block indefinitely until resumePool() is called.@Deprecated public void resumePool()
HikariPoolMXBean#resumePool() method on the HikariPoolMXBean
obtained by #getHikariPoolMXBean() or JMX lookup.public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic boolean isClosed()
@Deprecated public void shutdown()
close() insteadpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2017 Zaxxer.com. All Rights Reserved.