// Close returns the xstats to the sync.Pool
162184
func (xs *xstats) Close() error {
	if !DisablePooling {
		xs.s = nil
		xs.tags = nil
		xs.prefix = ""
		xs.delimiter = ""
		xstatsPool.Put(xs)
	}
	return nil
}
282282
func (p *ConnectionPool) Close() chan bool {
	done := make(chan bool)
	go func() {
		for len(p.pool) > 0 {
			c := <-p.pool
			c.returnOnClose = false
			c.Close()
		}
		done <- true
	}()
	return done
}
871293
func (c *Tx) Close() error {
	_ = c.Unwatch().Err()
	return c.baseClient.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)
}
767601
func (met *Metrics) Close() {
	for _, r := range met.rates {
		r.ticker.Stop()
	}
}
333187
func (xw *Writer) Close() error {
	if xw.err == errClosed {
		return nil
	}
	if xw.err != nil {
		return xw.err
	}

	// Flush final index.
	if xw.zw.OutputOffset+xw.zw.InputOffset > 0 || len(xw.idx.Records) > 0 {
		xw.err = xw.Flush(FlushIndex)
		if xw.err != nil {
			return xw.err
		}
	}

	// Encode the footer.
	err := xw.encodeFooter(xw.idx.BackSize)
	if err != nil {
		xw.err = err
	} else {
		xw.err = errClosed
	}
	return err
}
766752
func (fsi *fsIOPool) Close(path string) error {
	fsi.Lock()
	defer fsi.Unlock()

	if err := checkPathLength(path); err != nil {
		return err
	}

	// Pop readers from path.
	rlkFile, ok := fsi.readersMap[path]
	if !ok {
		return nil
	}

	// Close the reader.
	rlkFile.Close()

	// If the file is closed, remove it from the reader pool map.
	if rlkFile.IsClosed() {

		// Purge the cached lock path from map.
		delete(fsi.readersMap, path)
	}

	// Success.
	return nil
}
436712
func (buf *XmlBuffer)Close() {
	mtx.Lock()
	defer mtx.Unlock()
	delete(activeXmlBufs,buf.cnt)
}
9562
func (a syncOnWrite) Close() error {
    err := a.file.Sync()
    if err != nil {
        return err
    }
    return a.file.Close()
}
1203285
func (s *migrationLoggingStrategy) Close() error {
	err := errors.Annotate(
		s.tracker.Close(),
		"closing last-sent tracker",
	)
	s.releaser()
	return err
}
1265020
func (c *connectionTracker) Close() {
	c.lock.Lock()
	defer c.lock.Unlock()
	for conn := range c.conns {
		if err := conn.Close(); err != nil {
			log.WithoutContext().Errorf("Error while closing connection: %v", err)
		}
		delete(c.conns, conn)
	}
}
571943
func (p *PoolConn) Close() error {
	p.mu.RLock()
	defer p.mu.RUnlock()

	if p.unusable {
		if p.Conn != nil {
			return p.Conn.Close()
		}
		return nil
	}
	return p.c.put(p.Conn)
}
272404
func (s *Swarm) Close() error {
	defer close(s.closed)

	// automatically close everything new we get.
	s.SetConnHandler(func(c *Conn) { c.Close() })
	s.SetStreamHandler(func(s *Stream) { s.Close() })

	var wgl sync.WaitGroup
	for _, l := range s.Listeners() {
		wgl.Add(1)
		go func(list *Listener) {
			list.Close()
			wgl.Done()
		}(l)
	}
	wgl.Wait()

	var wgc sync.WaitGroup
	for _, c := range s.Conns() {
		wgc.Add(1)
		go func(conn *Conn) {
			conn.Close()
			wgc.Done()
		}(c)
	}
	wgc.Wait()
	return nil
}
1068
func (mux *Multiplexer) Close() {
	safeclose.Close(
		mux.Consumer,
		mux.hashSyncProducer,
		mux.hashAsyncProducer,
		mux.manSyncProducer,
		mux.manAsyncProducer)
}
523765
func Close(xs XStater) error {
	if c, ok := xs.(io.Closer); ok {
		return c.Close()
	}
	return nil
}
839726
func (p *pool) close() error {
	_, err := p.do(closeRequest, nil)
	return err
}
463278
func (c *BaseConn) Close() error {
	c.sMutex.Lock()
	defer c.sMutex.Unlock()

	// flush buffer
	err1 := c.stream.Flush()

	// close carrier
	err2 := c.carrier.Close()

	// handle errors
	if err1 != nil {
		return err1
	} else if err2 != nil {
		return err2
	}

	return nil
}