public class MysqlPooledConnection extends MysqlConnection
MysqlDataSource 进行管理。currentDatabaseName, databaseMonitor, executionMonitor, lastServerStatusInfo, mysqlChannel, readOnlyFlag, slowExecutionThreshold, timeout, transactionIsolation| 构造器和说明 |
|---|
MysqlPooledConnection(int connectionIndex,
ConnectionConfiguration configuration,
int timeout,
int slowExecutionThreshold,
UnusableServiceNotifier<MysqlConnection> unusableServiceNotifier,
PooledConnectionClosedNotifier closedNotifier)
构造一个可重复使用的 Mysql 数据库连接。
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
acquire(long maxOccupyTime)
占用当前数据库连接,如果占用成功,返回
true,否则返回 false。 |
void |
close() |
void |
closePhysicalConnection()
关闭数据库物理连接,释放资源。
|
int |
getConnectionIndex()
获得当前数据库连接在连接池中的索引位置。
|
boolean |
isLeaked()
判断当前数据库连接是否已泄漏(被占用时间超过获取连接时指定的
maxOccupyTime),如果当前连接已关闭,则返回 false。 |
java.lang.String |
toString() |
abort, clearWarnings, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getLastServerStatusInfo, getMetaData, getMysqlChannel, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, isValid, isWrapperFor, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setLastServerStatusInfo, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setTransactionIsolation, setTypeMap, unwrappublic MysqlPooledConnection(int connectionIndex,
ConnectionConfiguration configuration,
int timeout,
int slowExecutionThreshold,
UnusableServiceNotifier<MysqlConnection> unusableServiceNotifier,
PooledConnectionClosedNotifier closedNotifier)
throws java.lang.IllegalArgumentException,
BuildSocketException
connectionIndex - 当前数据库连接在连接池中的索引位置configuration - 建立 Mysql 数据库连接使用的配置信息,不允许为 nulltimeout - SQL 执行超时时间,单位:毫秒,如果等于 0,则没有超时时间限制,不允许设置小于 0 的值slowExecutionThreshold - 执行 Mysql 命令过慢最小时间,单位:毫秒,不能小于等于 0unusableServiceNotifier - MysqlConnection 不可用通知器,允许为 nullclosedNotifier - MysqlPooledConnection 连接关闭通知器java.lang.IllegalArgumentException - 如果 configuration 为 null,将会抛出此异常java.lang.IllegalArgumentException - 如果 timeout 小于 0,将会抛出此异常java.lang.IllegalArgumentException - 如果 slowExecutionThreshold 小于等于 0,将会抛出此异常BuildSocketException - 如果创建与 Mysql 服务器的 Socket 连接失败,将会抛出此异常public boolean acquire(long maxOccupyTime)
true,否则返回 false。maxOccupyTime - 最大占用时间,单位:毫秒,如果为 0,则没有最大时间限制public boolean isLeaked()
maxOccupyTime),如果当前连接已关闭,则返回 false。public int getConnectionIndex()
public void close()
close 在接口中 java.lang.AutoCloseableclose 在接口中 java.sql.Connectionclose 在类中 MysqlConnectionpublic void closePhysicalConnection()
public java.lang.String toString()
toString 在类中 MysqlConnectionCopyright © 2019. All Rights Reserved.