Attempts to close the connection safely
421644
protected function safeClose()
    {
        try {
            if (isset($this->input) && $this->input) {
                $this->close();
            }
        } catch (\Exception $e) {
            // Nothing here
        }
    }
1344213
def close_socket(self):
        ''''''
        log.debug("Closing socket")
        if self.sock:
            try:
                self.sock.close()
            except:
                pass

            self.sock = None
527538
def close(self):
    """"""
    try:
      self._conn.send((self._CLOSE, None))
      self._conn.close()
    except IOError:
      # The connection was already closed.
      pass
    self._process.join()
357441
@PreDestroy
    public void close() {
        synchronized (operationOnConnectionMonitor) {
            if (state == State.CLOSED) {
                LOGGER.warn("Attempt to close connection factory which is already closed");
                return;
            }
            LOGGER.info("Closing connection factory");
            if (connection != null) {
                try {
                    connection.close();
                    connection = null;
                } catch (IOException e) {
                    if (! connection.isOpen()) {
                        LOGGER.warn("Attempt to close an already closed connection");
                    } else {
                        LOGGER.error("Unable to close current connection", e);
                    }
                }
            }
            changeState(State.CLOSED);
            LOGGER.info("Closed connection factory");
        }
    }
716016
def close(self):
        """"""
        try:
            if self._connection:
                backend = self.create_backend()
                backend.close_connection(self._connection)
        except socket.error:
            pass
        self._closed = True
993882
def Close(self):
		
		if self.connection is not None:
			try:
				self.connection.commit()
				self.connection.close()
				self.connection = None
			except Exception, e:
				pass
1061702
def closeConnection(self):
        """"""
        print '%s call closeConnection' % self.port
        try:
            if self.handle:
                self.handle.close()
                self.handle = None
        except Exception, e:
            ModuleHelper.WriteIntoDebugLogger("closeConnection() Error: " + str(e))
1126501
def _close_connection(self):
        """"""
        if (self._mode == PROP_MODE_SERIAL):
            self._serial.close()
        elif (self._mode == PROP_MODE_TCP):
            self._socket.close()
        elif (self._mode == PROP_MODE_FILE):
            self._file.close()
813297
async def close(self):
        """"""
        conn = self._connection
        if conn is None:
            return
        try:
            while (await self.nextset()):
                pass
        finally:
            self._connection = None
148340
@Override
	public void close() {
		try {
			connection.close();
		} catch(IOException e) {
			log.log(Level.WARNING, "Could not close connection", e);
		}
	}
805794
async def close(self, event):
        """"""
        _LOGGER.info('Closing connection to Insteon Modem')
        self._closing = True
        self._auto_reconnect = False
        await self.protocol.close()
        if self.protocol.transport:
            self.protocol.transport.close()
        await asyncio.sleep(0, loop=self._loop)
        _LOGGER.info('Insteon Modem connection closed')
1008511
def close_connection(self, connection, force=False):
        """"""
        if force:
            try:
                connection.close()
            except self.operational_exceptions:
                self.config.logger.error('ConnectionFactory - failed closing')
            for name, conn in self.pool.iteritems():
                if conn is connection:
                    break
            del self.pool[name]
        else:
            pass
1279662
def close_connection(self, connection, force=False):
        """"""
        if force:
            print('PostgresPooled - delegating connection closure')
            try:
                super(PostgresPooled, self).close_connection(connection,
                                                                  force)
            except self.operational_exceptions:
                print('PostgresPooled - failed closing')
            for name, conn in self.pool.iteritems():
                if conn is connection:
                    break
            del self.pool[name]
        else:
            print('PostgresPooled - refusing to close connection')
459598
void closeCurrentConnections() {
        final CountDownLatch latch = new CountDownLatch(hostThreadData.size());
        for(final Map.Entry<XnioIoThread, HostThreadData> data : hostThreadData.entrySet()) {
            data.getKey().execute(new Runnable() {
                @Override
                public void run() {
                    ConnectionHolder d = data.getValue().availableConnections.poll();
                    while (d != null) {
                        IoUtils.safeClose(d.clientConnection);
                        d = data.getValue().availableConnections.poll();
                    }
                    data.getValue().connections = 0;
                    latch.countDown();
                }
            });
        }
        try {
            latch.await(10, TimeUnit.SECONDS);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
1226693
def close_connection(self):
        
        self.logger.debug("Close CLI Process '%s'" % self.cmd, extra={'type': '<->'})
        self.stop_process()
1306202
private static synchronized void closeRegisteredConnections() {
        for (Connection connection : activeConnections) {
            LOGGER.log(Level.INFO, "Forcing connection to {0}:{1} closed.",
                    new Object[]{connection.getHostname(), connection.getPort()});
            // force closed just in case
            connection.close();
        }
        activeConnections.clear();
    }
503278
void quietlyCloseConnection(final Connection connection, final String closureReason)
   {
      if (connection != null) {
         try {
            logger.debug("{} - Closing connection {}: {}", poolName, connection, closureReason);

            try {
               setNetworkTimeout(connection, SECONDS.toMillis(15));
            }
            catch (SQLException e) {
               // ignore
            }
            finally {
               connection.close(); // continue with the close even if setNetworkTimeout() throws
            }
         }
         catch (Exception e) {
            logger.debug("{} - Closing connection {} failed", poolName, connection, e);
         }
      }
   }