类 MysqlPooledConnection
- java.lang.Object
-
- com.mysql.cj.jdbc.MysqlPooledConnection
-
- 所有已实现的接口:
PooledConnection
- 直接已知子类:
MysqlXAConnection,SuspendableXAConnection
public class MysqlPooledConnection extends Object implements PooledConnection
This class is used to wrap and return a physical connection within a logical handle. It also registers and notifies ConnectionEventListeners of any ConnectionEvents
-
-
字段概要
字段 修饰符和类型 字段 说明 static intCONNECTION_CLOSED_EVENTThe flag for a connection being closed.static intCONNECTION_ERROR_EVENTThe flag for an exception being thrown.
-
构造器概要
构造器 构造器 说明 MysqlPooledConnection(JdbcConnection connection)Construct a new MysqlPooledConnection and set instance variables
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 voidaddConnectionEventListener(ConnectionEventListener connectioneventlistener)voidaddStatementEventListener(StatementEventListener listener)protected voidcallConnectionEventListeners(int eventType, SQLException sqlException)Notifies all registered ConnectionEventListeners of ConnectionEvents.voidclose()Invoked by the container (not the client), and should close the physical connection.ConnectiongetConnection()protected ConnectiongetConnection(boolean resetServerState, boolean forXa)protected ExceptionInterceptorgetExceptionInterceptor()protected static MysqlPooledConnectiongetInstance(JdbcConnection connection)voidremoveConnectionEventListener(ConnectionEventListener connectioneventlistener)voidremoveStatementEventListener(StatementEventListener listener)
-
-
-
构造器详细资料
-
MysqlPooledConnection
public MysqlPooledConnection(JdbcConnection connection)
Construct a new MysqlPooledConnection and set instance variables- 参数:
connection- physical connection to db
-
-
方法详细资料
-
getInstance
protected static MysqlPooledConnection getInstance(JdbcConnection connection) throws SQLException
- 抛出:
SQLException
-
addConnectionEventListener
public void addConnectionEventListener(ConnectionEventListener connectioneventlistener)
- 指定者:
addConnectionEventListener在接口中PooledConnection
-
removeConnectionEventListener
public void removeConnectionEventListener(ConnectionEventListener connectioneventlistener)
-
getConnection
public Connection getConnection() throws SQLException
- 指定者:
getConnection在接口中PooledConnection- 抛出:
SQLException
-
getConnection
protected Connection getConnection(boolean resetServerState, boolean forXa) throws SQLException
- 抛出:
SQLException
-
close
public void close() throws SQLExceptionInvoked by the container (not the client), and should close the physical connection. This will be called if the pool is destroyed or the connectionEventListener receives a connectionErrorOccurred event.- 指定者:
close在接口中PooledConnection- 抛出:
SQLException
-
callConnectionEventListeners
protected void callConnectionEventListeners(int eventType, SQLException sqlException)Notifies all registered ConnectionEventListeners of ConnectionEvents. Instantiates a new ConnectionEvent which wraps sqlException and invokes either connectionClose or connectionErrorOccurred on listener as appropriate.- 参数:
eventType- value indicating whether connectionClosed or connectionErrorOccurred calledsqlException- the exception being thrown
-
getExceptionInterceptor
protected ExceptionInterceptor getExceptionInterceptor()
-
addStatementEventListener
public void addStatementEventListener(StatementEventListener listener)
- 指定者:
addStatementEventListener在接口中PooledConnection
-
removeStatementEventListener
public void removeStatementEventListener(StatementEventListener listener)
- 指定者:
removeStatementEventListener在接口中PooledConnection
-
-