public class ConnectionObjectFactory extends Object implements ObjectFactory
| 限定符和类型 | 字段和说明 |
|---|---|
private Boolean |
autoCommit |
private ConnectionPool |
connectionPool |
private Integer |
defaultTransactionIsolationLevel |
private String |
driverClassName |
private ExecutorService |
executor |
private String |
jdbcUrl |
private String |
password |
private Integer |
statementCacheSize |
private String |
testSql |
private String |
user |
| 构造器和说明 |
|---|
ConnectionObjectFactory(ConnectionPool connectionPool) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
configureConnection(Connection connection) |
PooledConnection |
createObject()
Create object if unavaliable
|
void |
destroyObject(Object connection)
Release the pooled object and remove it from the pool.
|
Boolean |
getAutoCommit() |
Integer |
getDefaultTransactionIsolationLevel() |
String |
getDriverClassName() |
ExecutorService |
getExecutor() |
String |
getJdbcUrl() |
String |
getPassword() |
Integer |
getStatementCacheSize() |
String |
getTestSql() |
String |
getUser() |
void |
setAutoCommit(Boolean autoCommit) |
void |
setDefaultTransactionIsolationLevel(Integer defaultTransactionIsolationLevel)
Set default transaction level.
|
void |
setDriverClassName(String driverClassName)
Set the DriverClassName if the class exists.
|
void |
setExecutor(ExecutorService executor) |
void |
setJdbcUrl(String jdbcUrl) |
void |
setPassword(String password) |
void |
setStatementCacheSize(Integer statementCacheSize)
Set the pooled java.sql.PreparedStatement object cache's size.
|
void |
setTestSql(String testSql)
Set a test sql like 'SELECT 1' to testify its availability when borrow a
connection object.
|
void |
setUser(String user) |
protected void |
testSql(Connection connection,
String testSql)
Execute test sql
|
boolean |
validateObject(Object connection) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittestObjectprivate String user
private String password
private String driverClassName
private String jdbcUrl
private String testSql
private Boolean autoCommit
private Integer defaultTransactionIsolationLevel
private Integer statementCacheSize
private ExecutorService executor
private final ConnectionPool connectionPool
public ConnectionObjectFactory(ConnectionPool connectionPool)
public void setStatementCacheSize(Integer statementCacheSize)
statementCacheSize - public Integer getStatementCacheSize()
public Boolean getAutoCommit()
public void setAutoCommit(Boolean autoCommit)
public Integer getDefaultTransactionIsolationLevel()
public void setDefaultTransactionIsolationLevel(Integer defaultTransactionIsolationLevel)
defaultTransactionIsolationLevel - public String getTestSql()
public void setTestSql(String testSql)
testSql - public String getUser()
public void setUser(String user)
public ExecutorService getExecutor()
public String getPassword()
public void setPassword(String password)
public String getDriverClassName()
public void setDriverClassName(String driverClassName)
driverClassName - SQLExceptionpublic String getJdbcUrl()
public void setJdbcUrl(String jdbcUrl)
public void setExecutor(ExecutorService executor)
protected void configureConnection(Connection connection) throws SQLException
SQLExceptionprotected void testSql(Connection connection, String testSql) throws SQLException
connection - testSql - SQLExceptionpublic PooledConnection createObject() throws SQLException
ObjectFactorycreateObject 在接口中 ObjectFactorySQLExceptionpublic boolean validateObject(Object connection) throws SQLException
SQLExceptionpublic void destroyObject(Object connection) throws SQLException
ObjectFactorydestroyObject 在接口中 ObjectFactorySQLExceptionCopyright © 2021. All rights reserved.