Close a connection by its connection {@code key}. Pending connections are closed using future chaining.

@param key the connection {@code key}, must not be {@literal null}.
976145
public void close(K key) {

        LettuceAssert.notNull(key, "ConnectionKey must not be null!");

        Sync<K, T, F> sync = connections.get(key);
        if (sync != null) {
            connections.remove(key);
            sync.doWithConnection(AsyncCloseable::closeAsync);
        }
    }
217869
public void remove(RowKey key) {
		currentState.put( key, new AssociationOperation( key, null, REMOVE ) );
	}
861422
public final void closeConnection(final Connection conn) {
        try {
            if (conn != null) {
                conn.close();
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
906587
public static void closeQuietly(final Connection connection)
    {
        if (connection != null) {
            try {
                connection.close();
            }
            catch (JMSException je) {
                if (je.getCause() instanceof InterruptedException) {
                    LOG.trace("ActiveMQ caught and wrapped InterruptedException");
                }
                if (je.getCause() instanceof InterruptedIOException) {
                    LOG.trace("ActiveMQ caught and wrapped InterruptedIOException");
                }
                else {
                    LOG.warnDebug(je, "While closing connection");
                }
            }
        }
    }
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);
    }
1367263
void closeConnection(final PoolEntry poolEntry, final String closureReason)
   {
      if (connectionBag.remove(poolEntry)) {
         final Connection connection = poolEntry.close();
         closeConnectionExecutor.execute(() -> {
            quietlyCloseConnection(connection, closureReason);
            if (poolState == POOL_NORMAL) {
               fillPool();
            }
         });
      }
   }
1367599
public void setKey(String key) throws IOException {
    if (this.key != null) {
      throw new IOException("key already set");
    } else {
      this.key = Objects.requireNonNull(key, "key required");
    }
  }
15115
public V remove(final int key) {
		IntLinkedEntry<V> entry = removeEntry(key);
		if (entry == null) {
			return null;
		}
		V ret = entry.value;
		reuseAfterDelete(entry);

		return ret;
	}
295138
final void close(final ConnectionPoolConnection conn) {
      if(closeQueue != null) {
         closeQueue.add(conn);
      } else {
         closer.close(conn);
      }
   }
1012444
public void stopConnection() throws CommunicationException, KeystoreException {
		processedFailedNotifications();
		try {
			logger.debug("Closing connection");
			this.socket.close();
		} catch (Exception e) {
			/* Do not complain if connection is already closed... */
		}
	}
1062318
public void close() {

        this.closed = true;

        List<CompletableFuture<?>> closeFutures = new ArrayList<>();
        while (hasConnections()) {
            for (StatefulRedisConnection<String, String> connection : drainConnections()) {
                closeFutures.add(connection.closeAsync());
            }
        }

        Futures.allOf(closeFutures).join();
    }
483496
@Override
    public void del(byte[] key) {
        if (key == null) {
            return;
        }
        Jedis jedis = getJedis();
        try {
            jedis.del(key);
        } finally {
            jedis.close();
        }
    }
627477
public void setKey(String key) {
        if (key == null) {
            clearKey();
        } else {
            ThreadContext.putContext(dbName, key);
        }
        log.debug("set data source key[" + key + "]");
    }
638058
public void signIn(String key, Collection<WebSocketConnection> connections) {
        if (connections.isEmpty()) {
            return;
        }
        Map<WebSocketConnection, WebSocketConnection> newMap = new HashMap<>();
        for (WebSocketConnection conn : connections) {
            newMap.put(conn, conn);
        }
        ConcurrentMap<WebSocketConnection, WebSocketConnection> bag = ensureConnectionList(key);
        bag.putAll(newMap);
    }
151731
@Override
    public void close(ClusterName clusterName) {
        logger.info("Close connection to cluster [" + clusterName + "] from connector [" + this.getClass().getSimpleName()  + "]");
        connectionHandler.closeConnection(clusterName.getName());

    }
360087
@SuppressWarnings("unchecked")
    @Override
    public V remove(Object key) {
        LinkedHashMapSegment<K, V> seg = segmentFor(key.hashCode());
        try {
            seg.lock.lock();
            return mapEventListener.onRemoveEntry((K) key, seg.remove(key));
        } finally {
            seg.lock.unlock();
        }
    }
490317
public void removeByKey(Object key)
    {
        Object value = keyTable.remove(key);
        if (value != null)
        {
            valueTable.remove(value);
        }
    }