public class HikariDataSource extends com.zaxxer.hikari.HikariConfig implements DataSource, Closeable
Constructor and Description |
---|
HikariDataSource()
Default constructor.
|
HikariDataSource(com.zaxxer.hikari.HikariConfig configuration)
Construct a HikariDataSource with the specified configuration.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
close() and shutdown() are synonymous. |
void |
evictConnection(Connection connection)
Evict a connection from the pool.
|
Connection |
getConnection() |
Connection |
getConnection(String username,
String password)
Deprecated.
|
int |
getLoginTimeout() |
PrintWriter |
getLogWriter() |
Logger |
getParentLogger() |
boolean |
isWrapperFor(Class<?> iface) |
void |
resumePool()
Resume allocation of connections from the pool.
|
void |
setHealthCheckRegistry(Object healthCheckRegistry)
Set a Codahale HealthCheckRegistry to use for HikariCP.
|
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(PrintWriter out) |
void |
setMetricRegistry(Object metricRegistry)
Set a Codahale MetricRegistry to use for HikariCP.
|
void |
shutdown()
Shutdown the DataSource and its associated pool.
|
void |
suspendPool()
Suspend allocation of connections from the pool.
|
String |
toString() |
<T> T |
unwrap(Class<T> iface) |
addDataSourceProperty, addHealthCheckProperty, copyState, getCatalog, getConnectionCustomizer, getConnectionCustomizerClassName, getConnectionInitSql, getConnectionTestQuery, getConnectionTimeout, getDataSource, getDataSourceClassName, getDataSourceJNDI, getDataSourceProperties, getDriverClassName, getHealthCheckProperties, getHealthCheckRegistry, getIdleTimeout, getJdbcUrl, getLeakDetectionThreshold, getMaximumPoolSize, getMaxLifetime, getMetricRegistry, getMinimumIdle, getPassword, getPoolName, getThreadFactory, getTransactionIsolation, getUsername, getValidationTimeout, isAllowPoolSuspension, isAutoCommit, isInitializationFailFast, isIsolateInternalQueries, isJdbc4ConnectionTest, isReadOnly, isRegisterMbeans, setAllowPoolSuspension, setAutoCommit, setCatalog, setConnectionCustomizer, setConnectionCustomizerClassName, setConnectionInitSql, setConnectionTestQuery, setConnectionTimeout, setDataSource, setDataSourceClassName, setDataSourceJNDI, setDataSourceProperties, setDriverClassName, setHealthCheckProperties, setIdleTimeout, setInitializationFailFast, setIsolateInternalQueries, setJdbc4ConnectionTest, setJdbcUrl, setLeakDetectionThreshold, setMaximumPoolSize, setMaxLifetime, setMinimumIdle, setPassword, setPoolName, setReadOnly, setRegisterMbeans, setThreadFactory, setTransactionIsolation, setUsername, setValidationTimeout, validate
public HikariDataSource()
HikariDataSource(HikariConfig)
will
result in getConnection()
performance that is slightly lower
due to lazy initialization checks.public HikariDataSource(com.zaxxer.hikari.HikariConfig configuration)
configuration
- a HikariConfig instancepublic Connection getConnection() throws SQLException
getConnection
in interface DataSource
SQLException
@Deprecated public Connection getConnection(String username, String password) throws SQLException
getConnection
in interface DataSource
SQLException
public PrintWriter getLogWriter() throws SQLException
getLogWriter
in interface CommonDataSource
SQLException
public void setLogWriter(PrintWriter out) throws SQLException
setLogWriter
in interface CommonDataSource
SQLException
public void setLoginTimeout(int seconds) throws SQLException
setLoginTimeout
in interface CommonDataSource
SQLException
public int getLoginTimeout() throws SQLException
getLoginTimeout
in interface CommonDataSource
SQLException
public Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger
in interface CommonDataSource
SQLFeatureNotSupportedException
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
in interface Wrapper
SQLException
public boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
public void setMetricRegistry(Object metricRegistry)
setMetricRegistry
in class AbstractHikariConfig
metricRegistry
- the Codahale MetricRegistry to setpublic void setHealthCheckRegistry(Object healthCheckRegistry)
setHealthCheckRegistry
in class AbstractHikariConfig
healthCheckRegistry
- the Codahale HealthCheckRegistry to setpublic void evictConnection(Connection connection)
connection
- the connection to evict from the poolpublic void suspendPool()
getConnection()
will block indefinitely until resumePool()
is called.public void resumePool()
public void close()
close()
and shutdown()
are synonymous.close
in interface Closeable
close
in interface AutoCloseable
public void shutdown()
Copyright © 2015 Zaxxer.com. All Rights Reserved.