// Close clears the connection pool
493133
func (pool *connPool) Close() error {
	var errs []error
	for {
		c := pool.Get()
		if c == nil {
			return errors.NewMultiErr(errs)
		}
		// Fix the reusuedConnections stat being incremented by Get()
		atomic.AddInt64(&pool.stats.reusuedConnections, -1)
		errs = append(errs, c.Close())
	}
}
1240535
func (c *NamenodeConnection) Close() error {
	if c.conn != nil {
		return c.conn.Close()
	}
	return nil
}
1289178
func (tp *BytePool) Close() {
	tp.Drain()
	if tp.drainTicker != nil {
		tp.drainTicker.Stop()
		tp.drainTicker = nil
	}
}
1000644
func (c *Conn) close(err error) error {
	c.cancel()

	c.mu.Lock()
	if c.closed {
		c.mu.Unlock()
		return ErrConnClosing
	}
	c.closed = true
	if err == nil {
		err = ErrConnClosing
	}
	for id, call := range c.pending {
		delete(c.pending, id)
		call.done(err)
	}
	c.mu.Unlock()

	// Stop sending on all streams.
	c.streamMu.Lock()
	c.streams = nil
	c.streamMu.Unlock()

	// Conn can be nil if DialContext did not complete.
	if c.conn != nil {
		err = c.conn.Close()
	}

	return err
}
898574
func (r *Redis) Close() {
	if r.Pool == nil {
		log.Info("redis pool already closed")
		return
	}
	if err := r.Pool.Close(); err != nil {
		panic(err)
	}

	log.Info("redis pool closed")
}
918122
func (c *GRPCConnection) Close() {
	if !c.setClosed() {
		logger.Debug("Already closed")
		return
	}

	logger.Debug("Releasing connection....")
	c.commManager.ReleaseConn(c.conn)

	logger.Debug("... connection successfully closed.")
}
54089
func (p *Pool) Close() {
	p.mutex.Lock()
	defer p.mutex.Unlock()
	if p.closed {
		return
	}
	p.closed = true
	for e := p.l.Front(); e != nil; e = e.Next() {
		conn, _ := e.Value.(*Conn)
		conn.Close()
	}
	p.l.Init()
	p.currentNumberOfConn = p.l.Len()
	p.unusableNumberOfConn = 0
	p.cond.Broadcast()
}
839726
func (p *pool) close() error {
	_, err := p.do(closeRequest, nil)
	return err
}
264116
func (ctlr *Controller) Close() error {
	if ctlr.ownsPool {
		ctlr.pool.Close()
	}
	return nil
}
1169325
func (db *BytesConnectionRedis) Close() error {
	if db.closed {
		db.Debug("Close() called on a closed connection")
		return nil
	}
	db.Debug("Close()")
	db.closed = true
	safeclose.Close(db.closeCh)
	if db.client != nil {
		err := safeclose.Close(db.client)
		if err != nil {
			return fmt.Errorf("Close() encountered error: %s", err)
		}
	}
	return nil
}
1042844
func (c *Connection) Close() error {
	c.dbMu.Lock()
	defer c.dbMu.Unlock()

	if c.store != nil {
		if err := c.store.disconnect(c); err != nil {
			return err
		}
	}

	if c.db == nil {
		return nil
	}
	if err := c.db.Close(); err != nil {
		return err
	}
	c.db = nil
	return nil
}
809436
func (c *clientConn) Close() error {
	defer c.wg.Wait()
	return c.conn.Close()
}
334788
func (c *connection) Close() error {
	c.mu.Lock()
	if c.stopErr == nil {
		c.stopErr = ErrClosed
		close(c.stop)
	}
	c.mu.Unlock()
	return c.rw.Close()
}
862983
func (c *Connection) Close() {
	c.Lock()
	defer c.Unlock()
	if c.conn != nil {
		c.conn.Close()
		c.conn = nil
		if c.onClose != nil {
			c.onClose(c.id)
			c.onClose = nil
		}
	}
}
1045302
func (ctn *Connection) Close() {
	ctn.closer.Do(func() {
		if ctn != nil && ctn.conn != nil {
			// deregister
			if ctn.node != nil {
				ctn.node.connectionCount.DecrementAndGet()
				atomic.AddInt64(&ctn.node.stats.ConnectionsClosed, 1)
			}

			if err := ctn.conn.Close(); err != nil {
				Logger.Warn(err.Error())
			}
			ctn.conn = nil
			ctn.dataBuffer = nil
		}
	})
}
935442
func (c *GRPCClient) Close() error {
	c.broker.Close()
	c.controller.Shutdown(c.doneCtx, &plugin.Empty{})
	return c.Conn.Close()
}
482658
func (c *Cluster) Close() {
	c.callCh <- func(c *Cluster) {
		for addr, p := range c.pools {
			p.Empty()
			delete(c.pools, addr)
		}
		c.resetThrottle.Stop()
	}
	close(c.stopCh)
}