当前位置: 首页>>代码示例>>Java>>正文


Java PooledConnection.removeConnectionEventListener方法代码示例

本文整理汇总了Java中javax.sql.PooledConnection.removeConnectionEventListener方法的典型用法代码示例。如果您正苦于以下问题:Java PooledConnection.removeConnectionEventListener方法的具体用法?Java PooledConnection.removeConnectionEventListener怎么用?Java PooledConnection.removeConnectionEventListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.sql.PooledConnection的用法示例。


在下文中一共展示了PooledConnection.removeConnectionEventListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: connectionErrorOccurred

import javax.sql.PooledConnection; //导入方法依赖的package包/类
/**
 *
 * A fatal error has occurred and the connection cannot be used anymore.
 * A close event from such a connection should be ignored. The connection should not be reused.
 * A new connection will be created to replace the invalid connection, when the next client
 * calls getConnection().
 */
public synchronized void connectionErrorOccurred(ConnectionEvent event) {

    PooledConnection connection = (PooledConnection) event.getSource();

    connection.removeConnectionEventListener(this);
    this.connectionsInUse.remove(connection);
    this.sessionConnectionWrappers.remove(connection);
    logInfo(
        "Fatal exception occurred on pooled connection. Connection is removed from pool: ");
    logInfo(event.getSQLException());
    closePhysically(connection, "closing invalid, removed connection.");

    //notify threads waiting for connections or for the pool to close.
    //one waiting thread can now create a new connection since the pool has space for a new connection.
    //if a thread waits for the pool to close this could be the last unclosed connection in the pool.
    this.notifyAll();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:25,代码来源:ManagedPoolDataSource.java

示例2: disposeConnection

import javax.sql.PooledConnection; //导入方法依赖的package包/类
private synchronized void disposeConnection(PooledConnection pconn) {
    pconn.removeConnectionEventListener(poolConnectionEventListener);
    if (!recycledConnections.remove(pconn) && pconn != connectionInTransition) {
        // If the PooledConnection is not in the recycledConnections list
        // and is not currently within a PooledConnection.getConnection() call,
        // we assume that the connection was active.
        if (activeConnections <= 0) {
            throw new AssertionError();
        }
        activeConnections--;
        semaphore.release();
    }
    closeConnectionAndIgnoreException(pconn);
    assertInnerState();
}
 
开发者ID:stechy1,项目名称:drd,代码行数:16,代码来源:MiniConnectionPoolManager.java


注:本文中的javax.sql.PooledConnection.removeConnectionEventListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。