Package javax.sql

Examples of javax.sql.ConnectionEvent


      Object source = event.getSource();
      C connection = this.proxyFactory.get(this.database);
     
      if (Proxy.isProxyClass(source.getClass()) && Proxy.getInvocationHandler(source) instanceof AbstractPooledConnectionInvocationHandler)
      {
        return new ConnectionEvent(connection, event.getSQLException());
      }
     
      return event.getSource().equals(connection) ? event : null;
    }
View Full Code Here


     * @param exception the exception that caused the event, or {@code null} if
     * it is a close event
     */
    private void fireConnectionEventListeners(SQLException exception) {
        if (eventListener != null && !eventListener.isEmpty()) {
            ConnectionEvent event = new ConnectionEvent(this, exception);
            eventIterators++;
            try {
                for (Iterator it = eventListener.iterator(); it.hasNext();) {
                    ConnectionEventListener l =
                            (ConnectionEventListener) it.next();
View Full Code Here

    /**
     * sends a connectionClosed event.
     */
    void notifyListeners() {
        ConnectionEvent event = new ConnectionEvent(this);
        Object[] listeners = eventListeners.toArray();
        for (int i = 0; i < listeners.length; i++) {
            ((ConnectionEventListener) listeners[i]).connectionClosed(event);
        }
    }
View Full Code Here

        synchronized (connectionEventListeners) {
            if (connectionEventListeners.size() == 0)
                return;

            ConnectionEvent closedEvent = new ConnectionEvent(this, exception);
            for (final ConnectionEventListener nextListener : connectionEventListeners) {
                nextListener.connectionErrorOccurred(closedEvent);
            }
        }
    }
View Full Code Here

    protected void connectionClosedNotification() {
        synchronized (connectionEventListeners) {
            if (connectionEventListeners.size() == 0)
                return;

            ConnectionEvent closedEvent = new ConnectionEvent(this);

            for (final ConnectionEventListener nextListener : connectionEventListeners) {
                nextListener.connectionClosed(closedEvent);
            }
        }
View Full Code Here

//#endif JAVA6
    // ------------------------ internal implementation ------------------------
    synchronized public void connectionClosed() {

        ConnectionEvent event = new ConnectionEvent(this);

        userConnection = null;

        reset();
View Full Code Here

        }
    }

    synchronized public void connectionErrorOccured(SQLException e) {

        ConnectionEvent event = new ConnectionEvent(this, e);

        reset();

        for (int i = 0; i < listeners.size(); i++) {
            ConnectionEventListener connectionEventListener =
View Full Code Here

        if (t instanceof SQLException) {
            SQLException sqlEx = (SQLException) t;

            // broadcastConnectionError
            ConnectionEvent event = new ConnectionEvent(pooledConnection, sqlEx);
            for (ConnectionEventListener eventListener : holder.getConnectionEventListeners()) {
                eventListener.connectionErrorOccurred(event);
            }

            // exceptionSorter.isExceptionFatal
View Full Code Here

           
            while( it.hasNext() ) {
                ConnectionEventListener lstnr;

                lstnr = (ConnectionEventListener)it.next();
                lstnr.connectionClosed(new ConnectionEvent(this));
            }
            logical = null;
            listeners.notifyAll();
        }
    }
View Full Code Here

           
            while( it.hasNext() ) {
                ConnectionEventListener lstnr;

                lstnr = (ConnectionEventListener)it.next();
                lstnr.connectionErrorOccurred(new ConnectionEvent(this, e));
            }
        }
    }
View Full Code Here

TOP

Related Classes of javax.sql.ConnectionEvent

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.