Search in sources :

Example 11 with ConnectionEvent

use of javax.sql.ConnectionEvent in project voltdb by VoltDB.

the class LifeTimeConnectionWrapper method fireSqlExceptionEvent.

protected void fireSqlExceptionEvent(SQLException e) {
    ConnectionEvent event = new ConnectionEvent(this.pooledConnection, e);
    for (Iterator iterator = connectionListeners.iterator(); iterator.hasNext(); ) {
        ConnectionEventListener connectionEventListener = (ConnectionEventListener) iterator.next();
        connectionEventListener.connectionErrorOccurred(event);
    }
}
Also used : ConnectionEvent(javax.sql.ConnectionEvent) Iterator(java.util.Iterator) ConnectionEventListener(javax.sql.ConnectionEventListener)

Example 12 with ConnectionEvent

use of javax.sql.ConnectionEvent in project spanner-jdbc by olavloite.

the class CloudSpannerPooledConnection method fireConnectionClosed.

/**
 * Used to fire a connection closed event to all listeners.
 */
void fireConnectionClosed() {
    ConnectionEvent evt = null;
    // Copy the listener list so the listener can remove itself during this
    // method call
    ConnectionEventListener[] local = listeners.toArray(new ConnectionEventListener[listeners.size()]);
    for (ConnectionEventListener listener : local) {
        if (evt == null) {
            evt = createConnectionEvent(null);
        }
        listener.connectionClosed(evt);
    }
}
Also used : ConnectionEvent(javax.sql.ConnectionEvent) ConnectionEventListener(javax.sql.ConnectionEventListener)

Aggregations

ConnectionEvent (javax.sql.ConnectionEvent)12 ConnectionEventListener (javax.sql.ConnectionEventListener)10 SQLException (java.sql.SQLException)4 Filter (com.alibaba.druid.filter.Filter)2 FilterChainImpl (com.alibaba.druid.filter.FilterChainImpl)2 DruidPooledConnection (com.alibaba.druid.pool.DruidPooledConnection)2 Iterator (java.util.Iterator)2 PreparedStatement (java.sql.PreparedStatement)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 ReentrantLock (java.util.concurrent.locks.ReentrantLock)1 PooledObject (org.apache.tomcat.dbcp.pool2.PooledObject)1 DefaultPooledObject (org.apache.tomcat.dbcp.pool2.impl.DefaultPooledObject)1