Close this contexts, meaning this context object is removed as thread
context.<br/>
If not all connection are closed, all connection are closed.
548533
public void close()
    {
        Context.LOG.debug("close context for {}", this.person);
        QueryCache.cleanByKey(getRequestId());
        if (getThreadLocal().get() != null && getThreadLocal().get() == this) {
            getThreadLocal().set(null);
        }
    }
533655
private boolean closeAll(Context context)
   {
      boolean unclosed = false;
      CloseConnectionSynchronization ccs = getCloseConnectionSynchronization(true);

      for (org.ironjacamar.core.connectionmanager.ConnectionManager cm : context.getConnectionManagers())
      {
         for (org.ironjacamar.core.connectionmanager.listener.ConnectionListener cl :
                 context.getConnectionListeners(cm))
         {
            for (Object c : context.getConnections(cl))
            {
               if (ccs == null)
               {
                  unclosed = true;

                  if (Tracer.isEnabled())
                  {
                     Tracer.closeCCMConnection(cl.getManagedConnectionPool().getPool()
                                               .getConfiguration().getId(),
                                               cl.getManagedConnectionPool(),
                                               cl, c, context.toString());
                  }

                  closeConnection(c);
               }
               else
               {
                  ccs.add(c);
               }
            }
         }
      }

      return unclosed;
   }
977303
def close(self):
        
        if self.connection is not None:
            self.connection.close()
        if self.connection_fd is not None:
            self.connection_fd.close()
146621
@Override
	public final void close()
    {
    	externalAccessLock.writeLock().lock();
    	try
		{
	        if (closed)
	            return;
	        closed = true;
	        onConnectionClose();
		}
    	finally
    	{
    		externalAccessLock.writeLock().unlock();
    	}
    	onConnectionClosed();
    }
265297
@Override
  public synchronized void close() throws IOException {
    // TODO(zac) Determine the behavior when closing the context during operations.
    if (!mClosed) {
      mClosed = true;
      if (mCachingEnabled) {
        Factory.FILESYSTEM_CACHE.remove(new FileSystemKey(mFsContext.getClientContext()));
      }
      mFsContext.close();
    }
  }
577105
public CompletableFuture<Void> close() {
    CompletableFuture[] futures = new CompletableFuture[connections.size()];

    for (CompletableFuture<Connection> future : this.connectionFutures.values()) {
      future.cancel(false);
    }

    int i = 0;
    for (Connection connection : connections.values()) {
      futures[i++] = connection.close();
    }

    return CompletableFuture.allOf(futures);
  }
1309136
public void close() {
		if (this.sock != null)
			try {
				this.sock_in.close();
				this.sock_out.close();
				this.sock.close();
				this.sock=null;
				this.sock_in=null;
				this.sock_out=null;
			} catch (IOException e) {
			}
	}
344754
public void destroy()
    {
        for (Socket socket : sockets) {
            destroySocket(socket);
        }
        sockets.clear();

        for (Selector selector : selectors) {
            context.close(selector);
        }
        selectors.clear();

        // Only terminate context if we are on the main thread
        if (isMain()) {
            context.term();
        }
    }
1311723
@Override
    public void close()
    {
        if ( treeState.compareAndSet(TreeState.STARTED, TreeState.CLOSED) )
        {
            client.getConnectionStateListenable().removeListener(connectionStateListener);
            listeners.clear();
            executorService.shutdown();
            try
            {
                root.wasDeleted();
            }
            catch ( Exception e )
            {
                ThreadUtils.checkInterrupted(e);
                handleException(e);
            }
        }
    }
255477
def close(self):
        
        if self._Q is not None:
            for T in self._T:
                self._Q.interrupt()
            for n, T in enumerate(self._T):
                _log.debug('Join Context worker %d', n)
                T.join()
            _log.debug('Joined Context workers')
            self._Q, self._T = None, None
        super(Context, self).close()
1269465
@SuppressWarnings("unchecked")
    public CompletableFuture<Void> close() {

        this.closed = true;

        List<CompletableFuture<Void>> futures = new ArrayList<>();

        forEach((connectionKey, closeable) -> {

            futures.add(closeable.closeAsync());
            connections.remove(connectionKey);
        });

        return Futures.allOf(futures);
    }
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");
        }
    }
647413
def close(self):
        """"""
        self._condition.acquire()
        try:
            while self._idle_cache: # close all idle connections
                con = self._idle_cache.pop(0)
                try:
                    con._close()
                except Exception:
                    pass
                self._connections -=1
            self._condition.notifyAll()
        finally:
            self._condition.release()
815344
public static void endContext(ControlContainerContext context)
    {
        Stack<ControlContainerContext> contextStack = _threadContexts.get();
        if (contextStack == null || contextStack.size() == 0)
            throw new IllegalStateException("No context started for current thread");

        if (contextStack.peek() != context)
            throw new IllegalStateException("Context is not the current active context");

        contextStack.pop();
    }
450643
public synchronized void close() {
        for (PreparedStatement ps : threadedPsMap.get().values()) {
            if (null != ps) {
                try {
                    ps.close();
                } catch (SQLException e) {
                    // swallowed
                }
            }
        }
        try {
            if (null != connection) {
                this.connection.close();
            }
        } catch (SQLException e) {
            // swallowed
        }
    }
25756
def close(self):
        '''
        '''
        for connection in self.ready:
            connection.close()

        for connection in self.busy:
            connection.close()

        self._closed = True
81020
public synchronized void close() {
        if (!closed && channel != null) {
            ConnectionWatchdog watchdog = channel.getPipeline().get(ConnectionWatchdog.class);
            watchdog.setReconnect(false);
            closed = true;
            channel.close();
        }
    }