Force closes socket and stream readers/writers.
488134
public void abort() {
    this.explicitClosed = true;

    boolean lockStatus = false;
    if (lock != null) {
      lockStatus = lock.tryLock();
    }
    this.connected = false;

    abortActiveStream();

    if (!lockStatus) {
      //lock not available : query is running
      // force end by executing an KILL connection
      forceAbort();
      try {
        socket.setSoLinger(true, 0);
      } catch (IOException ioException) {
        //eat
      }
    } else {
      SendClosePacket.send(writer);
    }

    closeSocket(reader, writer, socket);
    cleanMemory();
    if (lockStatus) {
      lock.unlock();
    }
  }
1247665
def close(self):
        """"""
        self.rfile.close()

        if not self.linger:
            self._close_kernel_socket()
            self.socket.close()
        else:
            # On the other hand, sometimes we want to hang around for a bit
            # to make sure the client has a chance to read our entire
            # response. Skipping the close() calls here delays the FIN
            # packet until the socket object is garbage-collected later.
            # Someday, perhaps, we'll do the full lingering_close that
            # Apache does, but not today.
            pass
203984
def _close_socket(self):
        
        try:
            self.socket.shutdown(socket.SHUT_RDWR)
        except (OSError, socket.error):
            pass
        self.socket.close()
1283786
def close_client_stream(client_stream, unix_path):
    
    try:
        client_stream.shutdown(socket.SHUT_RDWR)
        if unix_path:
            logger.debug('%s: Connection closed', unix_path)
        else:
            peer = client_stream.getpeername()
            logger.debug('%s:%s: Connection closed', peer[0], peer[1])
    except (socket.error, OSError) as exception:
        logger.debug('Connection closing error: %s', exception)
    client_stream.close()
797827
@Override
    public void close() throws IOException {
        dispose();

        if(socket != null) {
            socket.close();
            socket = null;
        }
    }
17799
public void close()
        throws IOException
    {
        try{
            _completing=true;
            if (_connection instanceof Socket && !(_connection instanceof SSLSocket))
                ((Socket)_connection).shutdownOutput();
            _outputStream.close();
            _inputStream.close();
        }
        finally
        {
            if (_handlingThread!=null && Thread.currentThread()!=_handlingThread)
                _handlingThread.interrupt();
        }
    }
133675
@Override
  public void close() {
    unmap();
    writer.close();
    readers.forEach(reader -> reader.close());
    open = false;
  }
1091357
public void close() throws IOException {   
    if (closed) {
      checkWriteThread();
      return;
    }
    try {
      buffer.close(); 
      // writeThread should exit after this
      // and close underlying stream
      try {
        writeThread.join();
      } catch (InterruptedException e) {
        throw new IOException(e);
      }
    } finally {
      checkWriteThread();
    }
  }
605281
public void close() {
        done = true;
        connected = false;
        synchronized (this) {
            try {
                if (socket != null) {
                    if (traceLevel >= ctrlThreshold) {
                        System.out.println("-> CLOSE");
                    }
                    socket.close();
                }
            } catch (final IOException e) { /* ignore socket close errors */
            } finally {
                socket = null;
            }
        }
    }
175237
void close() {
        try {
            performTeardownExchange();
        } catch (IOException e) {
            logger.warn("Problem reporting our intention to close the dbserver connection", e);
        }
        try {
            channel.close();
        } catch (IOException e) {
            logger.warn("Problem closing dbserver client output channel", e);
        }
        try {
            os.close();
        } catch (IOException e) {
            logger.warn("Problem closing dbserver client output stream", e);
        }
        try {
            is.close();
        } catch (IOException e) {
            logger.warn("Problem closing dbserver client input stream", e);
        }
        try {
            socket.close();
        } catch (IOException e) {
            logger.warn("Problem closing dbserver client socket", e);
        }
    }
168891
def pub_close(self):
        '''
        
        '''
        if hasattr(self._sock_data, 'sock'):
            self._sock_data.sock.close()
            delattr(self._sock_data, 'sock')
614460
@Override
  public void closeWrite() throws IOException
  {
    if (_isCloseWrite) {
      return;
    }
    
    _isCloseWrite = true;
    
    //OutputStream os = _os;
    //_os = null;
    
    boolean isShutdownOutput = false;

    // since the output stream is opened lazily, we might
    // need to open it
    if (_s != null) {
      try {
        _s.shutdownOutput();
        
        isShutdownOutput = true;
      } catch (UnsupportedOperationException e) {
        log.log(Level.FINEST, e.toString(), e);
      } catch (Exception e) {
        log.finer(e.toString());
        log.log(Level.FINEST, e.toString(), e);
      }
    }

    /*
    // SSLSocket doesn't support shutdownOutput()
    if (! isShutdownOutput && os != null) {
      os.close();
    }
    */
  }
922764
public function stream_close() {
    assert(isset($this->client));
    $this->client->close();
    $this->client = null;
  }
1220537
private void cleanupWriterSocket(PrintWriter pwriter) {
        try {
            if (pwriter != null) {
                pwriter.flush();
                pwriter.close();
            }
        } catch (Exception e) {
            LOG.info("Error closing PrintWriter ", e);
        } finally {
            try {
                close();
            } catch (Exception e) {
                LOG.error("Error closing a command socket ", e);
            }
        }
    }
321949
public void close() throws IOException {
    if (closed) {
      return;
    }
    closed = true;

    stopIn();
    stopOut();

    // socket streams and socket itself should be already closed with stopIn() and stopOut()
    // but because it is idempotent, let's be good citizens and close corresponding streams as well
    in.close();
    out.close();

    terminateExecutor(readExecutor, "read");
    terminateExecutor(orchestratorExecutor, "orchestrator");

    socket.close();
  }
282233
function close() {
        $this->_error_log('closing socket ' . $this->sock);
        $this->_connection_closed = true;
        fclose($this->sock);
    }
936287
def close_async(self):
        """"""
        if self._stream is None or self._stream.closed():
            self._stream = None
            return
        send_data = struct.pack('<i', 1) + int2byte(COMMAND.COM_QUIT)
        yield self._stream.write(send_data)
        self.close()