Sends out a notification that there was an error with the connection
and closes the connection.

@param exception the exception that causes the connection close event.
431818
protected final void notifyConnectionError(final Exception exception) {
        if (!isConnected()) {
            LOGGER.log(Level.INFO, "Connection was already disconnected when attempting to handle " + exception,
                            exception);
            return;
        }

        ASYNC_BUT_ORDERED.performAsyncButOrdered(this, () -> {
            currentConnectionException = exception;

            for (StanzaCollector collector : collectors) {
                collector.notifyConnectionError(exception);
            }
            SmackWrappedException smackWrappedException = new SmackWrappedException(exception);
            tlsHandled.reportGenericFailure(smackWrappedException);
            saslFeatureReceived.reportGenericFailure(smackWrappedException);
            lastFeaturesReceived.reportGenericFailure(smackWrappedException);
            // TODO From XMPPTCPConnection. Was called in Smack 4.3 where notifyConnectionError() was part of
            // XMPPTCPConnection. Create delegation method?
            // maybeCompressFeaturesReceived.reportGenericFailure(smackWrappedException);

            synchronized (AbstractXMPPConnection.this) {
                notifyAll();

                // Closes the connection temporary. A if the connection supports stream management, then a reconnection is
                // possible. Note that a connection listener of e.g. XMPPTCPConnection will drop the SM state in
                // case the Exception is a StreamErrorException.
                instantShutdown();
            }

            Async.go(() -> {
                // Notify connection listeners of the error.
                callConnectionClosedOnErrorListener(exception);
            }, AbstractXMPPConnection.this + " callConnectionClosedOnErrorListener()");
        });
    }
737271
@OnError
    public void onError(Throwable throwable) throws IOException {
        close(new CloseReason(throwable instanceof MessageTooBigException ?
                CloseCodes.TOO_BIG : CloseCodes.CLOSED_ABNORMALLY, throwable.getMessage()));
    }
481046
public void close() throws java.io.IOException
  {
                if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
                        logger.logp(Level.FINE, CLASS_NAME,"close", "Closing");
        }

                if (_observer != null) {
      _observer.alertClose();
    }
    super.close();
  }
1290049
public void warn(Object message, Throwable exception) {
        log(Level.WARNING, String.valueOf(message), exception);
    }
893621
@Override
    void connectionError(SibRaMessagingEngineConnection connection, SIException exception)
    {
        String methodName = "connectionError";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.entry(this, TRACE, methodName, new Object[] { connection, exception });
        }

        /*
         * We have lost our remote connection, output a warning to the
         * admin console, close the connection and schedule an attempt
         * to create a new one
         */

        SibTr.warning(TRACE, "CONNECTION_ERROR_CWSIV0776",
                      new Object[] { connection.getConnection().getMeName(),
                                    _endpointConfiguration.getBusName(), this,
                                    exception });

        dropConnection(connection, false, true, true);

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.exit(this, TRACE, methodName);
        }
    }
395853
public void exception(Throwable e) {
    final String msg = e.getMessage();
    log(Level.SEVERE, msg != null ? msg : "An exception occurred.", e);
  }
792909
public synchronized void transferError(Exception e) {
	logger.debug("intercepted exception", e);
	if (transferException == null) {
	    transferException = e;
	} else if (transferException instanceof InterruptedException
		   || transferException instanceof InterruptedIOException) {
	    //if one of the threads throws an error, it interrupts
	    //the other thread (by InterruptedException).
	    //Here we make sure that transferException will store the
	    //primary failure reason, not the resulting InterruptedException
	    transferException = e;
	}
	notifyAll();
    }
254642
def shutdown(exception)
      begin
        notify_event(:shutdown, { :exception_message => exception.message })
      rescue => e
        $stderr.puts([e.message, e.backtrace].join("\n")) rescue nil
      end
      @config = default_config
      @config[:enabled] = false
    end
1245047
@Override
  public void close() throws Exception {
    if (closed.compareAndSet(false, true)) {
      executor.shutdown();
      completionExecutor.shutdown();
      if (!executor.awaitTermination(shutdownTimeout, TimeUnit.MILLISECONDS)) {
        LOG.log(Level.WARNING, "Executor did not terminate in " + shutdownTimeout + "ms.");
        final List<Runnable> droppedRunnables = executor.shutdownNow();
        LOG.log(Level.WARNING, "Executor dropped " + droppedRunnables.size() + " tasks.");
      }
      if (!completionExecutor.awaitTermination(shutdownTimeout, TimeUnit.MILLISECONDS)) {
        LOG.log(Level.WARNING, "Executor did not terminate in " + shutdownTimeout + "ms.");
        final List<Runnable> droppedRunnables = completionExecutor.shutdownNow();
        LOG.log(Level.WARNING, "Completion executor dropped " + droppedRunnables.size() + " tasks.");
      }
    }
  }
1301894
void error(String message, boolean useEndLineNumber) throws Exception {
		StoryException e = new StoryException(message);
		e.useEndLineNumber = useEndLineNumber;
		throw e;
	}
1093966
private void errorNewClientConnected(Exception exception)
    {
        Verbose.warning(Server.class, "addClient", "Error on adding client: ", exception.getMessage());
        if (clients.remove(Byte.valueOf(lastId)) != null)
        {
            clientsNumber--;
        }
    }
891590
void endOffering(IOException exception) {
    if (closed) {
      return;
    }

    // closed should never be set by this method--only the polling side should do it, as it means
    // that the CLOSED marker has been encountered.

    if (this.exception == null) {
      this.exception = exception;
    }

    // Since this is an unbounded queue, offer() always succeeds.
    queue.offer(CLOSED);
  }
650681
@Override
    public void close() throws Exception {         

        if(webConnection_closeComplete){
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "WebConnection close previously completed ...return ");
            }
            return;
        }
        else{
            // this is for the case to avoid infinite loop if handler destroy end up calling webconnection close.  
            if(upgradeHandler_DestroyStarted){
                return;
            }
            synchronized(this) {
                //check it again 
                if(webConnection_closeComplete || webConnection_closeOngoing){
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "WebConnection close previously completed .....return ");
                    }
                    return;
                }
                webConnection_closeOngoing = true;


                //      Call UpgradeHandler destroy() API.      
                //upgradeHandler_DestroyComplete  is needed if close is called again from complete , we do not call destroy again
                if (!upgradeHandler_DestroyComplete && _upgradeHandler != null) { 
                    /// call application handler class destroy

                    try{ 
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "call Handler destroy "+ this._upgradeHandler);                      
                        } 
                        upgradeHandler_DestroyStarted= true;
                        _upgradeHandler.destroy();
                    }
                    finally{
                        upgradeHandler_DestroyComplete = true;
                        upgradeHandler_DestroyStarted= false;
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "Handler destroy successful"+ this._upgradeHandler);                      
                        }
                    }
                }          

                if(_in != null && (_in.getInputBufferHelper().get_tcpChannelCallback() != null)){
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, " input callback");
                    }
                    inputCallback = true;
                }

                //close the streams , make sure even if one fails we close rest. 
                try{
                    if(_in!= null)
                        _in.close();
                }catch(IOException ioe){
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, " closing of inputStream failed ..");
                    }
                    closeUpgradeException = ioe;
                }

                // now close output
                // close connection
                closeOutputandConnection();
            }
        }
    }
68763
public static void e(Throwable e) {
		messager.printMessage(Diagnostic.Kind.ERROR, "exception thrown! " + e.getMessage());
	}
920640
public static void checkConnectionException(SQLException exception,
      MariaDbConnection connection) {
    if (exception.getSQLState() != null) {
      SqlStates state = SqlStates.fromString(exception.getSQLState());
      if (SqlStates.CONNECTION_EXCEPTION.equals(state)) {
        connection.setHostFailed();
        if (connection.pooledConnection != null) {
          connection.pooledConnection.fireConnectionErrorOccured(exception);
        }
      }
    }
  }
614245
public void error(Object message, Throwable exception) {
        log(Level.SEVERE, String.valueOf(message), exception);
    }
943055
public void notifyUserAboutException(Thread thread, final Throwable throwable) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                final ErrorInfo errorInfo = new ErrorInfo(
                        resolveExceptionCaption(throwable),
                        (String) createExceptionContent(throwable),
                        getDetailsAsHTML(throwable.getMessage(), throwable),
                        null, throwable, Level.SEVERE,  null);
                JXErrorPane pane = new JXErrorPane();
                pane.setErrorInfo(errorInfo);
                if (errorReporter != null) {
                    pane.setErrorReporter(errorReporter);
                }
                JXErrorPane.showDialog(resolveParentFrame(), pane);
            }
        });
    }