public void onConnectionFailure()

in qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsConnection.java [1388:1452]


    public void onConnectionFailure(final ProviderException ex) {
        providerFailed(ex);

        if (!closing.get() && !closed.get()) {
            LOG.warn("Connection {} has failed due to: {}", connectionInfo.getId(), ex != null ? ex.getMessage() : "No error details provided.");
        }

        // Signal that connection dropped we need to mark transactions as
        // failed, deliver failure events to asynchronous send completions etc.
        for (JmsSession session : sessions.values()) {
            try {
                session.onConnectionInterrupted();
            } catch (Throwable t) {
                LOG.warn("Exception while marking session interrupted", t);
            }
        }

        onProviderException(ex);

        for (AsyncResult request : requests.keySet()) {
            try {
                request.onFailure(ex);
            } catch (Exception e) {
                LOG.debug("Exception during request cleanup", e);
            }
        }

        if (!closing.get() && !closed.get()) {
            executor.execute(new Runnable() {
                @Override
                public void run() {
                    if (provider != null) {
                        try {
                            provider.close();
                        } catch (Throwable error) {
                            LOG.debug("Error while closing failed Provider: {}", error.getMessage());
                        }
                    }

                    for (AsyncResult request : requests.keySet()) {
                        try {
                            request.onFailure(ex);
                        } catch (Exception e) {
                            LOG.debug("Exception during request cleanup", e);
                        }
                    }

                    try {
                        shutdown(ex);
                    } catch (JMSException e) {
                        LOG.warn("Exception during connection cleanup, " + e, e);
                    }

                    for (JmsConnectionListener listener : connectionListeners) {
                        listener.onConnectionFailure(ex);
                    }

                    // Don't accept any more connection work but allow all pending work
                    // to complete in order to ensure notifications are sent to any blocked
                    // resources.
                    executor.shutdown();
                }
            });
        }
    }