Code example for PooledConnection

Methods: addConnectionEventListener

0
                throw new IllegalStateException("Connection pool data source returned null from getPooledConnection");
            } 
 
            // should we add this object as a listener or the pool. 
            // consider the validateObject method in decision 
            pc.addConnectionEventListener(this);
            pci = new PooledConnectionAndInfo(pc, _username, _password);
            pcMap.put(pc, pci);
        } catch (SQLException e) {
            throw new RuntimeException(e.getMessage());
        } 
        return new DefaultPooledObject<>(pci);
    } 
 
    /** 
     * Closes the PooledConnection and stops listening for events from it. 
     */ 
    @Override 
    public void destroyObject(PooledObject<PooledConnectionAndInfo> p) throws Exception {
        doDestroyObject(p.getObject());