Fired when channel is Closed

@param e
342704
private void fireOnClosed(ChannelEvent e) {
        if (readyState == ReadyState.CLOSED) {
            // If the channel has been closed, then we should not fire events.
            return;
        }
        
        readyState = ReadyState.CLOSED;
        List<EventListener> listeners = changes.getListenerList(AMQP);
        for (EventListener listener : listeners) {
            ChannelListener amqpListener = (ChannelListener)listener;
            amqpListener.onClose(e);
        }
    }
224427
def close(self):
        """"""
        if self._channel and not self._channel.handler.channel_close:
            self._channel.close()
        self._channel_ref = None
1235355
protected void postCloseEvent(final WebSocketCloseCode closeCode, final String reason) {
        for (final WebSocketListener listener : listeners) {
            if (listener.onClose(this, closeCode, reason)) {
                break;
            }
        }
    }
913978
public void fireGeneralEvent(GeneralEvent e)
    {
        Object[] listeners = listenerList.getListenerList();

        // notify those that are interested in this event
        for (int i = listeners.length - 2; i >= 0; i -= 2)
        {
            if (listeners[i] == GeneralEventListener.class)
            {
                ((GeneralEventListener) listeners[i + 1]).generalEventUpdate(e);
            }
        }

    }
70504
@Handler(channels = NetworkChannel.class)
    public void onClosed(Closed event, TcpChannel netConnChannel) {
        netConnChannel.associated(WebAppMsgChannel.class).ifPresent(
            appChannel -> appChannel.handleClosed(event));
        pooled.remove(netConnChannel.remoteAddress(), netConnChannel);
    }
854291
private void fireOnGetBasic(ChannelEvent e) {
        List<EventListener> listeners = changes.getListenerList(AMQP);
        for (EventListener listener : listeners) {
            ChannelListener amqpListener = (ChannelListener)listener;
            amqpListener.onGetBasic(e);
        }
    }
499137
public void close() {

		boolean performClose = false;
		;

		synchronized (this) {
			if (!closing && state == CHANNEL_OPEN) {
				performClose = closing = true;
			}
		}

		if (performClose) {

			synchronized (listeners) {
				for (Enumeration<ChannelEventListener> e = listeners.elements(); e
						.hasMoreElements();) {
					(e.nextElement()).channelClosing(this);
				}
			}

			try {
				// Close the ChannelOutputStream
				out.close(!isLocalEOF);

				// Send our close message
				ByteArrayWriter msg = new ByteArrayWriter(5);
				msg.write(SSH_MSG_CHANNEL_CLOSE);
				msg.writeInt(remoteid);

				try {
					if (Log.isDebugEnabled()) {
						Log.debug(this,
								"Sending SSH_MSG_CHANNEL_CLOSE id=" + channelid
										+ " rid=" + remoteid);
					}
					connection.sendMessage(msg.toByteArray(), true);
				} catch (SshException ex1) {
					if (Log.isDebugEnabled()) {
						Log.debug(this,
								"Exception attempting to send SSH_MSG_CHANNEL_CLOSE id="
										+ channelid + " rid=" + remoteid, ex1);
					}
				} finally {
					msg.close();
				}

				this.state = CHANNEL_CLOSED;

			} catch (EOFException eof) {
				// Ignore this is the message store informing of close/eof
			} catch (SshIOException ex) {
				if (Log.isDebugEnabled()) {
					Log.debug(this,
							"SSH Exception during close reason="
									+ ex.getRealException().getReason()
									+ " id=" + channelid + " rid=" + remoteid,
							ex.getRealException());
				}
				// IO Error during close so the connection has dropped
				connection.transport.disconnect(
						TransportProtocol.CONNECTION_LOST,
						"IOException during channel close: " + ex.getMessage());
			} catch (IOException ex) {
				if (Log.isDebugEnabled()) {
					Log.debug(this, "Exception during close id="
							+ channelid + " rid=" + remoteid, ex);
				}
				// IO Error during close so the connection has dropped
				connection.transport.disconnect(
						TransportProtocol.CONNECTION_LOST,
						"IOException during channel close: " + ex.getMessage());
			} finally {
				checkCloseStatus(ms.isClosed());
			}
		}
	}
381468
void fireConnectionFatalError(SQLException e) {
    ConnectionEvent evt = null;
    // Copy the listener list so the listener can remove itself during this
    // method call
    ConnectionEventListener[] local =
        listeners.toArray(new ConnectionEventListener[listeners.size()]);
    for (ConnectionEventListener listener : local) {
      if (evt == null) {
        evt = createConnectionEvent(e);
      }
      listener.connectionErrorOccurred(evt);
    }
  }
835483
public void close(VirtualConnection inVC, Exception e) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "close(), " + this);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            try {
                if (inVC != null) {
                    Tr.debug(tc, "Closing the connection: " + inVC.getConnectionDescriptor());
                }
            } catch (NullPointerException npe) {
                // ignore this race condition since it is only for debug
            }
        }

        // synchronize on this TCPConnlink to prevent duplicate closes from being
        // processed
        // this can happen when the channel shuts down and close is called from
        // elsewhere
        // doing a quick synch with a boolean will help channel stop run faster
        boolean processClose = true;
        synchronized (this) {
            if (this.closed) {
                processClose = false;
            }
            this.closed = true;
        }

        if (processClose) {
            super.close(inVC, e);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "close()");
        }
    }
672615
void fireOnConnecting(ConnectionEvent e) {
        List<EventListener> listeners = changes.getListenerList(AMQP);
        for (EventListener listener : listeners) {
            ConnectionListener amqpListener = (ConnectionListener)listener;
            amqpListener.onConnecting(e);
        }
    }
17748
public void close(VirtualConnection inVC, Exception e) {

        // when the channel above calls close() on the outbound connection then
        // we are done... no need to purge anything off the socket like we do
        // on the inbound side (purge request body if they never read it)

        // pass the close down the chain.
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Closing this outbound link: " + this + " " + getVirtualConnection());
        }
        setAllowReconnect(false);
        if (!this.earlyReconnectDestroy) {
            super.close(inVC, e);
        } else {
            destroy(e);
        }
    }
631486
private void socketClosedHandler() {
        // If the book-keeping has already been completed earlier, then
        // we should just bail.
        if (getReadyState() == ReadyState.CLOSED) {
            return;
        }
        
        // TODO: Determine whether channels need to be cleaned up
        if (this.channels.size() != 0) {
            // Iterate over the channels and close them.
            for (int i = 1; i <= this.channels.size(); i++) { // 1-based
                AmqpChannel channel = this.channels.get(i);
                AmqpFrame   f = new AmqpFrame();
                
                // Close the channel and ensure that the CLOSE event is
                // fired on the registered ChannelListener objects.
                f.setMethodName("closeChannel");
                f.setChannelId((short) i);
                channel.channelClosedHandler(this, "", f, "closeChannel");
            }
        }
        
        // Mark the readyState as CLOSED.
        readyState = ReadyState.CLOSED;

        // Fire the CLOSE event on the ConnectionListener(s) registered on
        // the AmqpClient object.
        fireOnClosed(new ConnectionEvent(this, Kind.CLOSE));
    }
823554
private void fireOnDeleteExchange(ChannelEvent e) {
        List<EventListener> listeners = changes.getListenerList(AMQP);
        for (EventListener listener : listeners) {
            ChannelListener amqpListener = (ChannelListener)listener;
            amqpListener.onDeleteExchange(e);
        }
    }
949355
@SuppressWarnings("PMD.UseVarargs")
    public void fire(Event<?> event, Channel[] channels) {
        eventPipeline.add(event, channels);
    }
716678
public void eventSunk(final ChannelPipeline pipeline, final ChannelEvent e)
            throws Exception {

        final NioChildDatagramChannel childChannel = (NioChildDatagramChannel) e.getChannel();
        final ChannelFuture childFuture = e.getFuture();
        if (e instanceof ChannelStateEvent) {
            final ChannelStateEvent stateEvent = (ChannelStateEvent) e;
            final ChannelState state = stateEvent.getState();
            final Object value = stateEvent.getValue();
            switch (state) {
                case OPEN:
                    if (Boolean.FALSE.equals(value)) {
                        childChannel.worker.close(childChannel, childFuture);
                    }
                    break;
            }
        } else if (e instanceof MessageEvent) {
            // Making sure that child channel WriteFuture is fired on child channel's worker thread
            final MessageEvent childMessageEvent = (MessageEvent) e;
            ParentMessageEvent parentMessageEvent = new ParentMessageEvent(childMessageEvent);
            ChannelFuture parentFuture = parentMessageEvent.getFuture();
            parentFuture.addListener(f -> {
                childChannel.getWorker().executeInIoThread(() -> {
                    if (f.isSuccess()) {
                        childFuture.setSuccess();
                    } else {
                        childFuture.setFailure(f.getCause());
                    }
                });
            });

            // Write to parent channel
            NioDatagramChannel parentChannel = (NioDatagramChannel) childChannel.getParent();
            boolean offered = parentChannel.writeBufferQueue.offer(parentMessageEvent);
            assert offered;
            parentChannel.worker.writeFromUserCode(parentChannel);
        }
    }
146052
static void closeOnFlush(Channel ch) {
        if (ch.isActive()) {
            ch.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
        }
    }
469028
void fireOnOpen(ConnectionEvent e) {
        List<EventListener> listeners = changes.getListenerList(AMQP);
        for (EventListener listener : listeners) {
            ConnectionListener amqpListener = (ConnectionListener)listener;
            amqpListener.onConnectionOpen(e);
        }
    }