Release a connection back into the pool.
        This method is thread safe.
978347
def release(self, connection):
        
        with self.lock:
            connection.in_use = False
            self.cond.notify_all()
82449
def close(self):
        
        if not self._conn:
            raise psycopg2.InterfaceError('Connection not open')
        LOGGER.info('Closing connection %r in %s', self._conn, self.pid)
        self._pool_manager.free(self.pid, self._conn)
        self._pool_manager.remove_connection(self.pid, self._conn)

        # Un-assign the connection and cursor
        self._conn, self._cursor = None, None
68769
def remove_connection(self, connection):
        """"""
        if not self._closing:
            self.connections.remove(connection)
            logger.debug("removed connection")
247621
static void release(BufferPool.Buffer buff) throws IOException {
    if (buff.buf.length == staticConf.getSmallBufferSize()) {
      smallBufferPool.put(buff);
    } else if (buff.buf.length == staticConf.getMediumBufferSize()) {
      mediumBufferPool.put(buff);
    } else if (buff.buf.length == staticConf.getLargeBufferSize()) {
      largeBufferPool.put(buff);
    }
  }
923818
final public void releaseConnection(C connection) throws E {
		// Find the associated PooledConnection
		PooledConnection<C> pooledConnection = null;
		List<PooledConnection<C>> threadConnections = currentThreadConnections.get();
		for(int c=threadConnections.size()-1; c>=0; c--) {
			PooledConnection<C> threadConnection = threadConnections.get(c);
			synchronized(threadConnection) {
				if(threadConnection.connection==connection) {
					pooledConnection = threadConnection;
					threadConnections.remove(c);
					break;
				}
			}
		}
		if(pooledConnection==null) {
			logger.log(Level.WARNING, "PooledConnection not found during releaseConnection");
		} else {
			try {
				boolean closeConnection = false;
				boolean connIsClosed;
				try {
					connIsClosed = isClosed(connection);
				} catch(Exception err) {
					logger.log(Level.SEVERE, null, err);
					connIsClosed = false;
					closeConnection = true; // Force closure due to error on isClosed
				}
				if(connIsClosed) {
					// Already closed
					synchronized(pooledConnection) {
						pooledConnection.connection = null;
					}
				} else {
					if(maxConnectionAge!=UNLIMITED_MAX_CONNECTION_AGE) {
						long age = System.currentTimeMillis()-pooledConnection.createTime;
						if(age<0 || age>=maxConnectionAge) closeConnection = true;
					}
					if(closeConnection) {
						// Error on isClosed or max age reached, close the connection
						try {
							close(connection);
						} catch(Exception err) {
							logger.log(Level.SEVERE, null, err);
						}
						synchronized(pooledConnection) {
							pooledConnection.connection = null;
						}
					} else {
						// Reset connections as they are released
						try {
							resetConnection(connection);
						} catch(Exception err) {
							// Close the connection when error during reset
							logger.log(Level.SEVERE, null, err);
							try {
								close(connection);
							} catch(Exception err2) {
								logger.log(Level.SEVERE, null, err2);
							}
							synchronized(pooledConnection) {
								pooledConnection.connection = null;
							}
						}
					}
				}
			} finally {
				// Unallocate the connection from the pool
				release(pooledConnection);
			}
		}
	}
20654
public synchronized void release()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "release");

      released = true;
      valid = false;

      if (receivedBuffer != null)
      {
         receivedBuffer.release();
         receivedBuffer = null;
      }
      if (receivedData != null)
      {
         receivedData.release();
         receivedData = null;
      }

      if (dataList != null)
      {
         for (int x = 0; x < dataList.size(); x++)
         {
            dataList.get(x).release();
         }

         dataList.clear();
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "release");
   }
1064329
def release(self):
        
        try:
            if self._rotateFailed:
                self._close()
        except Exception:
            self.handleError(NullLogRecord())
        finally:
            try:
                if self.stream_lock and not self.stream_lock.closed:
                    unlock(self.stream_lock)
            except Exception:
                self.handleError(NullLogRecord())
            finally:
                # release thread lock
                if Handler:
                    Handler.release(self)
441226
public void release() throws IOException {
    for (BufferPool.Buffer b: buffers) {
      PooledBuffers.release(b);
    }

    buffers.clear();
    count = 0;
  }
295138
final void close(final ConnectionPoolConnection conn) {
      if(closeQueue != null) {
         closeQueue.add(conn);
      } else {
         closer.close(conn);
      }
   }
788596
def remove(self, connection):
        ''''''
        key = (connection.host, connection.port)
        with self._lock:
            found = self._connections.pop(key, None)
        try:
            self.close_connection(found)
        except Exception as exc:
            logger.warn('Failed to close %s: %s', connection, exc)
        return found
1142498
def free(cls, pid, connection):
        
        with cls._lock:
            LOGGER.debug('Freeing %s from pool %s', id(connection), pid)
            cls._ensure_pool_exists(pid)
            cls._pools[pid].free(connection)
1093703
def close(self):
        """"""
        # Instead of actually closing the connection,
        # unshare it and/or return it to the pool.
        if self._con:
            self._pool.unshare(self._shared_con)
            self._shared_con = self._con = None
1193674
public void close() {
    synchronized (lock) {
      while (!available.isEmpty()) {
        PooledConnection pci = available.pop();
        try {
          pci.close();
        } catch (SQLException e) {
        }
      }
      available = null;
      while (!used.isEmpty()) {
        PooledConnection pci = used.pop();
        pci.removeConnectionEventListener(connectionEventListener);
        try {
          pci.close();
        } catch (SQLException e) {
        }
      }
      used = null;
    }
    removeStoredDataSource();
  }
398335
async def close(self):
        
        if self._pool is not None and not isinstance(self.connection, aioredis.Redis):
            self._pool.close()
            await self._pool.wait_closed()
        self._pool = None
1285236
def reopen(self):
        """"""
        # If the connection is already back in the pool,
        # get another connection from the pool,
        # otherwise reopen the underlying connection.
        if self._con:
            self._con.reopen()
        else:
            self._con = self._pool.connection()
262065
protected void closeConnection(ConnectionHandle connection) {
		if (connection != null) {
			try {
				connection.internalClose();
			} catch (Throwable t) {
				logger.error("Destroy connection exception", t);
			} finally {
				this.pool.postDestroyConnection(connection);
			}
		}
}
1057839
def release(self, conn):
        
        self._in_use.remove(conn)
        if conn.reader.at_eof() or conn.reader.exception():
            self._do_close(conn)
        else:
            self._pool.put_nowait(conn)