Package javax.sql

Examples of javax.sql.PooledConnection


    /**
     * Returns closed connection to the pool.
     */
    public synchronized void connectionClosed(ConnectionEvent event) {
        // return connection to the pool
        PooledConnection closedConn = (PooledConnection) event.getSource();
       
        // remove this connection from the list of connections
        // managed by this pool...
        int usedInd = usedPool.indexOf(closedConn);
        if (usedInd >= 0) {
View Full Code Here


     */
    public synchronized void connectionErrorOccurred(ConnectionEvent event) {
        // later on we should analyze the error to see if this
        // is fatal... right now just kill this PooledConnection

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

        // remove this connection from the list of connections
        // managed by this pool...

        int usedInd = usedPool.indexOf(errorSrc);
View Full Code Here

        return ref;
    }

    // ------------------------ event listener ------------------------
    public void connectionClosed(ConnectionEvent event) {
        PooledConnection connection = (PooledConnection) event.getSource();

        for (int i = 0; i < connections.length; i++) {
            if (connections[i] == connection) {
                states.set(i, RefState.available);
View Full Code Here

            }
        }
    }

    public void connectionErrorOccurred(ConnectionEvent event) {
        PooledConnection connection = (PooledConnection) event.getSource();

        for (int i = 0; i < connections.length; i++) {
            if (connections[i] == connection) {
                states.set(i, RefState.allocated);
                connections[i] = null;
View Full Code Here

    throws SQLException
  {
    long start = start();
   
    try {
      PooledConnection conn = _dataSource.getPooledConnection();

      String connId = _id + "." + _connCount.getAndIncrement();

      log(start, "getConnectionPool() -> " + connId + ":" + conn);
View Full Code Here

    throws SQLException
  {
    long start = start();
   
    try {
      PooledConnection conn = _dataSource.getPooledConnection(user, password);

      String connId = _id + "." + _connCount.getAndIncrement();

      log(start, "getPooledConnection(" + user + ") -> " + connId + ":" + conn);
View Full Code Here

        listener = new PooledConnectionListener();

        try {
            for (int c = 0; c < initialConnections; c += 1) {
                PooledConnection pooledConnection = createPooledConnection();
                freeConnections.add(pooledConnection);
            }
        } catch (SQLException sqle) {
            logger.error("sql-exception", sqle);
            throw new JDBCRepositoryException(sqle);
View Full Code Here

    // ---- DataSource/ConnectionPoolDataSource interface start ----

    public Connection getConnection()
            throws SQLException {

        PooledConnection pooledConnection = getPooledConnection();
        Connection connection = pooledConnection.getConnection();

        if (logger.isDebugEnabled()) {
            logger.debug("Got connection " + connection
                         + " from pooled connection " + pooledConnection);
        }
View Full Code Here

    }

    public PooledConnection getPooledConnection()
            throws SQLException {

        PooledConnection pooledConnection = null;
        boolean notifyThread = false;

        if (logger.isDebugEnabled()) {
            logger.debug("Attempting to lock ConnectionPool");
        }
View Full Code Here

     * @return A free pooled connection.
     */
    private PooledConnection getFreePooledConnection() {
        int free = freeConnections.size();

        PooledConnection pooledConnection
                = (PooledConnection) freeConnections.remove(free - 1);

        busyConnections.add(pooledConnection);

        return pooledConnection;
View Full Code Here

TOP

Related Classes of javax.sql.PooledConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.