public class HikariCPConnectionFactory extends BaseConnectionFactory
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOG
The Constant LOG.
|
Constructor and Description |
---|
HikariCPConnectionFactory(JdbcDataSource dataSource)
Instantiates a new HikariCP connection factory.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
close
|
Connection |
getConnection() |
Connection |
getConnection(String username,
String password) |
DataSource |
getDataSource()
getDataSource
|
int |
getLoginTimeout()
getLoginTimeout
|
PrintWriter |
getLogWriter() |
Logger |
getParentLogger() |
String |
getUrl()
getUrl
|
String |
getUser()
getUser
|
protected void |
initializePool(JdbcDataSource dataSource) |
void |
setIdleTimeout(int idleTimeout)
How long, in seconds, an idle connection is kept in the pool before it is removed.
|
void |
setLoginTimeout(int seconds)
How long, in seconds, to attempt to make a connection to the database.
|
void |
setLogWriter(PrintWriter out) |
void |
setMaxLifetime(int maxLifetimeMs)
Set the maximum lifetime of the connections in the pool (in milliseconds)
which forces occasional connection recycling.
|
void |
setMaxPool(int maxPool)
The maximum number of pooled connections to retain.
|
void |
setMaxSize(int maxSize)
The maximum number of connections that can be created.
|
void |
setMinPool(int minPool)
The minimum number of pooled connections to retain.
|
void |
setUrl(String url)
setUrl
|
void |
setUser(String user)
setUser
|
isWrapperFor, unwrap, validateJdbcUrl
public HikariCPConnectionFactory(JdbcDataSource dataSource) throws PropertyVetoException, SQLException
dataSource
- the data sourcePropertyVetoException
- the property veto exceptionSQLException
- the SQL exceptionprotected void initializePool(JdbcDataSource dataSource) throws SQLException
initializePool
in class BaseConnectionFactory
SQLException
public Connection getConnection() throws SQLException
SQLException
public String getUrl()
BaseConnectionFactory
getUrl
getUrl
in class BaseConnectionFactory
String
object.public void setUrl(String url)
BaseConnectionFactory
setUrl
setUrl
in class BaseConnectionFactory
url
- a String
object.public String getUser()
BaseConnectionFactory
getUser
getUser
in class BaseConnectionFactory
String
object.public void setUser(String user)
BaseConnectionFactory
setUser
setUser
in class BaseConnectionFactory
user
- a String
object.public DataSource getDataSource()
BaseConnectionFactory
getDataSource
getDataSource
in class BaseConnectionFactory
DataSource
object.public Connection getConnection(String username, String password) throws SQLException
SQLException
public PrintWriter getLogWriter() throws SQLException
SQLException
public void setLogWriter(PrintWriter out) throws SQLException
SQLException
public void setLoginTimeout(int seconds) throws SQLException
ClosableDataSource
SQLException
public int getLoginTimeout() throws SQLException
BaseConnectionFactory
getLoginTimeout
getLoginTimeout
in interface CommonDataSource
getLoginTimeout
in class BaseConnectionFactory
SQLException
- if any.public Logger getParentLogger() throws SQLFeatureNotSupportedException
SQLFeatureNotSupportedException
public void close()
BaseConnectionFactory
close
close
in interface Closeable
close
in interface AutoCloseable
close
in interface ClosableDataSource
close
in class BaseConnectionFactory
public void setIdleTimeout(int idleTimeout)
ClosableDataSource
public void setMaxLifetime(int maxLifetimeMs)
maxLifetimeMs
- public void setMinPool(int minPool)
ClosableDataSource
public void setMaxPool(int maxPool)
ClosableDataSource
public void setMaxSize(int maxSize)
ClosableDataSource
Copyright © 2020. All rights reserved.