Close the remote endpoint with with a {@code GO_AWAY} frame. Does <strong>not</strong> flush
immediately, this is the responsibility of the caller.
967041
private ChannelFuture goAway(ChannelHandlerContext ctx, Http2Exception cause, ChannelPromise promise) {
        long errorCode = cause != null ? cause.error().code() : NO_ERROR.code();
        int lastKnownStream = connection().remote().lastStreamCreated();
        return goAway(ctx, lastKnownStream, errorCode, Http2CodecUtil.toByteBuf(ctx, cause), promise);
    }
66816
@Override
    public void close() throws IOException
    {
        flush();
        
        buf = null;
        
        if ( rwChannel.isOpen() )
        {

            rwChannel.close();
        }
        
        raFile.close();
    }
62081
public void close() {
        Iterator<SocketDestination> it = getStatsMap().keySet().iterator();
        while(it.hasNext()) {
            try {
                SocketDestination destination = it.next();
                JmxUtils.unregisterMbean(JmxUtils.createObjectName(JmxUtils.getPackageName(ClientRequestExecutor.class),
                                                                   "stats_"
                                                                           + destination.toString()
                                                                                        .replace(':',
                                                                                                 '_')
                                                                           + identifierString));
            } catch(Exception e) {}
        }
    }
136853
@Override
    public void removeEndPoint(String name) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Deleting endpoint: " + name);
        }

        synchronized (this.endpoints) {
            if (this.endpoints.remove(name) != null) {
                unregisterMBeanInService(name);
            }
        }
    }
1010101
protected void safeClose () {
        Session closeSession = this.socketSession;
        this.socketSession = null;

        try {
            if (closeSession != null) {
                //
                // Remove from the registry first in case the close blocks for a while.  Doing so prevents additional
                // errors logged for attempts to send to this now-defunct websocket.
                //
                registry.remove(this.socketSessionId);
                closeSession.close();
            }
        } catch (IOException ioExc) {
            log.debug("io exception on safe close of session", ioExc);
        }
    }
451917
public void exiting(Object object) {
        if (!getLogger().isLoggable(Level.FINER)) {
            return;
        }
        FrameInfo fi = getLoggingFrame();
        getLogger().exiting(fi.className, fi.methodName, object);
    }
686564
public void close() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(this, tc, "close");
        }

        // Doing a channel.close() will actually put the keys associated with this
        // channel
        // into the associated selectors cancelledKey list, but they don't get
        // removed until the
        // next time the selector runs. In some cases, we need to make sure they are
        // really gone before we
        // we close the channel, because another thread may have requested another
        // operation
        // on the channel at the same time, which causes problems on some OS'es.
        // So, cancel them manually and wait for the selector to run once before
        // continuing

        // call super.close() to see if we are using Regular Sockets, and if so, let
        // the parent class handle closing the socket
        super.close();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(this, tc, "SocketChannel closing, local: " + socket.getLocalSocketAddress() + " remote: " + socket.getRemoteSocketAddress());
        }

        // synchronize on this SocketIOChannel to prevent duplicate closes from
        // being processed
        synchronized (this) {
            if (closed) {
                processClose = false;
            }
            closed = true;
        }

        if (processClose) {

            // checkCancel is only on if we need to manually cancel keys as
            // the socket close() is supposed to do that for us
            if (checkCancel) {
                // Remove socket from current selectors.
                if (channelSelectorRead != null) {
                    SelectionKey k = channelSelectorRead.getKey(channel);
                    if (k != null) {
                        CancelRequest cr = new CancelRequest(k);
                        synchronized (cr) {
                            channelSelectorRead.addCancelRequest(cr);
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                Tr.debug(this, tc, "waiting for read key to be canceled, key is " + k);
                            }
                            try {
                                cr.wait();
                            } catch (InterruptedException e) {
                                // No FFDC code needed
                            }
                        } // end-sync
                    }
                }
                if (channelSelectorWrite != null) {
                    SelectionKey k = channelSelectorWrite.getKey(channel);
                    if (k != null) {
                        CancelRequest cr = new CancelRequest(k);
                        synchronized (cr) {
                            channelSelectorWrite.addCancelRequest(cr);
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                Tr.debug(this, tc, "waiting for write key to be canceled, key is " + k);
                            }
                            try {
                                cr.wait();
                            } catch (InterruptedException e) {
                                // No FFDC code needed
                            }
                        } // end-sync
                    }
                }
            }

            try {
                if (channel != null) {
                    channel.close();
                }

                // need to make sure the keys get cancelled after the close call
                if (channelSelectorRead != null) {
                    channelSelectorRead.wakeup();
                    channelSelectorRead = null;
                }
                if (channelSelectorWrite != null) {
                    channelSelectorWrite.wakeup();
                    channelSelectorWrite = null;
                }

            } catch (Throwable t) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(this, tc, "Error closing channel: " + t);
                }
                // ignore all shutdown/close errors
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(this, tc, "close");
        }
    }
1359281
public void onCloseRemote(CloseInfo closeInfo) {
        if (LOG.isDebugEnabled())
            LOG.debug("onCloseRemote({})", closeInfo);
        ConnectionState event = null;
        synchronized (this) {
            if (this.state == ConnectionState.CLOSED) {
                // already closed
                return;
            }

            if (LOG.isDebugEnabled())
                LOG.debug("onCloseRemote(), input={}, output={}", inputAvailable, outputAvailable);

            this.closeInfo = closeInfo;

            // turn off further input
            inputAvailable = false;

            if (closeHandshakeSource == CloseHandshakeSource.NONE) {
                closeHandshakeSource = CloseHandshakeSource.REMOTE;
            }

            if (!outputAvailable) {
                LOG.debug("Close Handshake satisfied, disconnecting");
                cleanClose = true;
                state = ConnectionState.CLOSED;
                finalClose.compareAndSet(null, closeInfo);
                event = this.state;
            } else if (this.state == ConnectionState.OPEN) {
                // We are now entering CLOSING (or half-closed)
                this.state = ConnectionState.CLOSING;
                event = this.state;
            }
        }

        // Only notify on state change events
        if (event != null) {
            notifyStateListeners(event);
        }
    }
746496
public void close() {
    clientLock.writeLock().lock();
    try {
      if (client != null) {
        RPC.stopProxy(client);
        client = null;
      }
    } finally {
      clientLock.writeLock().unlock();
    }
  }
478854
public void closeWindowPerformed(SwingFrame frameView) {
		if (!navigationFrames.contains(frameView)) return;
		
		if (navigationFrames.size() == 1 && !askBeforeExit(frameView)) {
			return;
		}
		
		if (frameView.tryToCloseWindow()) {
			removeNavigationFrameView(frameView);
		}
	}
236886
public void leavePage(String targetUri) {

        if (m_frame != null) {
            m_frame.removeFromParent();
            m_frame = null;
        }
        if (m_handler != null) {
            m_handler.leavePage(targetUri);
        } else {
            Window.Location.assign(targetUri);
        }
    }
344764
public void close() {
        if (connected.compareAndSet(true, false)) {
            // remove handshake flag
            session.removeAttribute(Constants.HANDSHAKE_COMPLETE);
            // clear the delay queue
            queue.clear();
            // whether to attempt a nice close or a forceful one
            if (WebSocketTransport.isNiceClose()) {
                // send a proper ws close
                Packet packet = Packet.build(Constants.CLOSE_MESSAGE_BYTES, MessageType.CLOSE);
                WriteFuture writeFuture = session.write(packet);
                writeFuture.addListener(new IoFutureListener<WriteFuture>() {

                    @Override
                    public void operationComplete(WriteFuture future) {
                        if (future.isWritten()) {
                            log.debug("Close message written");
                            // only set on success for now to skip boolean check later
                            session.setAttribute(Constants.STATUS_CLOSE_WRITTEN, Boolean.TRUE);
                        }
                        future.removeListener(this);
                    }

                });
                // adjust close routine to allow for flushing
                CloseFuture closeFuture = session.closeOnFlush();
                closeFuture.addListener(new IoFutureListener<CloseFuture>() {

                    public void operationComplete(CloseFuture future) {
                        if (future.isClosed()) {
                            log.debug("Connection is closed");
                        } else {
                            log.debug("Connection is not yet closed");
                        }
                        future.removeListener(this);
                    }

                });
            } else {
                // force close
                CloseFuture closeFuture = session.closeNow();
                closeFuture.addListener(new IoFutureListener<CloseFuture>() {

                    public void operationComplete(CloseFuture future) {
                        if (future.isClosed()) {
                            log.debug("Connection is closed");
                        } else {
                            log.debug("Connection is not yet closed");
                        }
                        future.removeListener(this);
                    }

                });
            }
        }
    }
775968
public ChannelFuture close(Channel channel, CloseWebSocketFrame frame) {
        if (channel == null) {
            throw new NullPointerException("channel");
        }
        return close(channel, frame, channel.newPromise());
    }
1176640
@Override
    public ChannelFuture close(Channel channel, CloseWebSocketFrame frame, ChannelPromise promise) {
        return channel.writeAndFlush(frame, promise);
    }
1234067
private void closeOutgoingSockets() throws ClientException {

        SocketOperator op = new SocketOperator() {
                public void operate(SocketBox sb) throws Exception {
                    if (((ManagedSocketBox) sb).isReusable()) {
                        Socket s = sb.getSocket();
                        if (s != null) {
                            // write the closing Eblock and close the socket
                            EBlockImageDCWriter.close(
                                  new DataOutputStream(s.getOutputStream()));
                        }
                    }
                }
       };

        try {
            socketPool.applyToAll(op);
        } catch (IOException e) {
            // ignore - sometimes server might close the socket
        } catch (Exception e) {
            ClientException ce =
                new ClientException(ClientException.SOCKET_OP_FAILED);
            ce.setRootCause(e);
            throw ce;
        }
    }
18553
@Override
    public void close()
    {
        isOpen.set(false);
        Iterator<Future<?>> iterator = futures.iterator();
        while ( iterator.hasNext() )
        {
            Future<?> future = iterator.next();
            iterator.remove();
            if ( !future.isDone() && !future.isCancelled() && !future.cancel(true) )
            {
                log.warn("Could not cancel " + future);
            }
        }
        if (shutdownOnClose) {
            executorService.shutdownNow();
        }
    }
1325640
public synchronized void close() throws IOException, InterruptedException {
		if (isClosed){
			return;
		}

		logger.info("closing server endpoint");
		idPriv.destroyId();
		group.unregisterServerEp(this);
		isClosed = true;
	}