當前位置: 首頁>>代碼示例>>Java>>正文


Java PooledConnection.close方法代碼示例

本文整理匯總了Java中javax.sql.PooledConnection.close方法的典型用法代碼示例。如果您正苦於以下問題:Java PooledConnection.close方法的具體用法?Java PooledConnection.close怎麽用?Java PooledConnection.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.sql.PooledConnection的用法示例。


在下文中一共展示了PooledConnection.close方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: dispose

import javax.sql.PooledConnection; //導入方法依賴的package包/類
/**
 * Closes all unused pooled connections.
 */
public synchronized void dispose() throws SQLException {
    if (isDisposed) {
        return;
    }
    isDisposed = true;
    SQLException e = null;
    while (!recycledConnections.isEmpty()) {
        PooledConnection pconn = recycledConnections.remove();
        try {
            pconn.close();
        } catch (SQLException e2) {
            if (e == null) {
                e = e2;
            }
        }
    }
    if (e != null) {
        throw e;
    }
}
 
開發者ID:stechy1,項目名稱:drd,代碼行數:24,代碼來源:MiniConnectionPoolManager.java

示例2: closePhysically

import javax.sql.PooledConnection; //導入方法依賴的package包/類
private void closePhysically(PooledConnection source, String logText) {

        try {
            source.close();
        } catch (SQLException e) {
            logInfo("Error " + logText, e);
        }
    }
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:9,代碼來源:ManagedPoolDataSource.java

示例3: testBug62452WithConnection

import javax.sql.PooledConnection; //導入方法依賴的package包/類
private void testBug62452WithConnection(PooledConnection con) throws Exception {
    this.pstmt = con.getConnection().prepareStatement("SELECT 1");
    this.rs = this.pstmt.executeQuery();
    con.close();

    // If PooledConnection is already closed by some reason a NullPointerException was thrown on the next line
    // because the closed connection has nulled out the list that it synchronises on when the closed event is fired.
    this.pstmt.close();
}
 
開發者ID:bragex,項目名稱:the-vigilantes,代碼行數:10,代碼來源:ConnectionRegressionTest.java

示例4: testBug4808

import javax.sql.PooledConnection; //導入方法依賴的package包/類
/**
 * Tests fix for BUG#4808- Calling .close() twice on a PooledConnection
 * causes NPE.
 * 
 * @throws Exception
 *             if an error occurs.
 */
public void testBug4808() throws Exception {
    MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();
    ds.setURL(BaseTestCase.dbUrl);
    PooledConnection closeMeTwice = ds.getPooledConnection();
    closeMeTwice.close();
    closeMeTwice.close();

}
 
開發者ID:bragex,項目名稱:the-vigilantes,代碼行數:16,代碼來源:DataSourceRegressionTest.java

示例5: closeConnectionAndIgnoreException

import javax.sql.PooledConnection; //導入方法依賴的package包/類
private void closeConnectionAndIgnoreException(PooledConnection pconn) {
    try {
        pconn.close();
    } catch (SQLException e) {
        log("Error while closing database connection: " + e.toString());
    }
}
 
開發者ID:stechy1,項目名稱:drd,代碼行數:8,代碼來源:MiniConnectionPoolManager.java


注:本文中的javax.sql.PooledConnection.close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。