Search in sources :

Example 1 with BadConnectionEventListener

use of com.sun.appserv.connectors.internal.spi.BadConnectionEventListener in project Payara by payara.

the class ManagedConnectionImpl method transactionCompleted.

/**
 * This method is called from XAResource wrapper object
 * when its XAResource.end() has been called or from
 * LocalTransactionImpl object when its end() method is called.
 */
void transactionCompleted() {
    try {
        transactionInProgress = false;
        if (connectionType == ISPOOLEDCONNECTION || connectionType == ISXACONNECTION) {
            if (connectionCount <= 0) {
                try {
                    actualConnection.close();
                    actualConnection = null;
                } catch (SQLException sqle) {
                    actualConnection = null;
                }
            }
        }
    } catch (java.lang.NullPointerException e) {
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "jdbc.duplicateTxCompleted");
        }
    }
    if (markedForRemoval) {
        if (aborted) {
            com.sun.appserv.connectors.internal.spi.BadConnectionEventListener bcel = (BadConnectionEventListener) listener;
            bcel.connectionAbortOccurred(ce);
            _logger.log(Level.INFO, "jdbc.markedForRemoval_conAborted");
            markedForRemoval = false;
            myLogicalConnection.setClosed(true);
        } else {
            connectionErrorOccurred(null, null);
            _logger.log(Level.INFO, "jdbc.markedForRemoval_txCompleted");
            markedForRemoval = false;
        }
    }
    isClean = true;
}
Also used : BadConnectionEventListener(com.sun.appserv.connectors.internal.spi.BadConnectionEventListener) SQLException(java.sql.SQLException) BadConnectionEventListener(com.sun.appserv.connectors.internal.spi.BadConnectionEventListener)

Example 2 with BadConnectionEventListener

use of com.sun.appserv.connectors.internal.spi.BadConnectionEventListener in project Payara by payara.

the class ManagedConnectionImpl method connectionClosed.

/**
 * This method is called by the <code>ConnectionHolder30</code> when its close method is
 * called. This <code>ManagedConnection</code> instance  invalidates the connection handle
 * and sends a CONNECTION_CLOSED event to all the registered event listeners.
 *
 * @param e                  Exception that may have occured while closing the connection handle
 * @param connHolder30Object <code>ConnectionHolder30</code> that has been closed
 * @throws SQLException in case closing the sql connection got out of
 *                      <code>getConnection</code> on the underlying
 *                      <code>PooledConnection</code> throws an exception
 */
public void connectionClosed(Exception e, ConnectionHolder connHolder30Object) throws SQLException {
    connHolder30Object.invalidate();
    decrementCount();
    ce.setConnectionHandle(connHolder30Object);
    if (markedForRemoval && !transactionInProgress) {
        com.sun.appserv.connectors.internal.spi.BadConnectionEventListener bcel = (BadConnectionEventListener) listener;
        bcel.badConnectionClosed(ce);
        _logger.log(Level.INFO, "jdbc.markedForRemoval_conClosed");
        markedForRemoval = false;
    } else {
        listener.connectionClosed(ce);
    }
}
Also used : BadConnectionEventListener(com.sun.appserv.connectors.internal.spi.BadConnectionEventListener) BadConnectionEventListener(com.sun.appserv.connectors.internal.spi.BadConnectionEventListener)

Aggregations

BadConnectionEventListener (com.sun.appserv.connectors.internal.spi.BadConnectionEventListener)2 SQLException (java.sql.SQLException)1