Release connection.

@param pool the pool
@param conn the conn
509271
void releaseConnection(ConnectionPool pool, Cassandra.Client conn)
    {
        if (pool != null && conn != null)
        {
            pool.release(conn);
        }
    }
651596
function Connection(conn) {
	if(!(this instanceof Connection)) {
		return new Connection(conn);
	}
	var self = this;
	if(!conn) { throw new TypeError("no connection set"); }
	self._connection = conn;
	self._connect    = Q.nfbind(self._connection.connect.bind(self._connection));
	self._query      = Q.nfbind(self._connection.query.bind(self._connection));

	// These do not have callbacks when PoolConnection is used
	//self._end        = Q.nfbind(self._connection.end.bind(self._connection));
	//self._release        = Q.nfbind(self._connection.release.bind(self._connection));

	self._changeUser = Q.nfbind(self._connection.changeUser.bind(self._connection));
	db.Connection.call(self, conn);
}
83628
public static void close(Connection conn, Statement stmt, ResultSet rs) {
        close(rs);
        close(stmt);
        close(conn);
    }
1008172
def _release(self):
        """"""
        if self._in_use is None:
            # The holder is not checked out.
            return

        if not self._in_use.done():
            self._in_use.set_result(None)
        self._in_use = None

        # Deinitialize the connection proxy.  All subsequent
        # operations on it will fail.
        if self._proxy is not None:
            self._proxy._detach()
            self._proxy = None

        # Put ourselves back to the pool queue.
        self._pool._queue.put_nowait(self)
1366187
public static void remove(Pool pool) {
    if (poolMap.containsKey(pool.getUrlParser())) {
      synchronized (poolMap) {
        if (poolMap.containsKey(pool.getUrlParser())) {
          poolMap.remove(pool.getUrlParser());
          shutdownExecutor();
        }
      }
    }
  }
814001
public void connectionReleased(IManagedConnectionEvent<C> event) {
        IPhynixxManagedConnection<C> proxy = event.getManagedConnection();
        if (!proxy.hasCoreConnection()) {
            return;
        } else {
            this.releaseConnection(proxy);
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("Proxy " + proxy + " released");
        }

    }
1264834
private void releaseConnection()
   {
      if (m_rs != null)
      {
         try
         {
            m_rs.close();
         }

         catch (SQLException ex)
         {
            // silently ignore errors on close
         }

         m_rs = null;
      }

      if (m_ps != null)
      {
         try
         {
            m_ps.close();
         }

         catch (SQLException ex)
         {
            // silently ignore errors on close
         }

         m_ps = null;
      }
   }
798217
def release(self, connection: Connection):
        '''
        '''
        assert not self._closed

        key = connection.key
        host_pool = self._host_pools[key]

        _logger.debug('Check in %s', key)

        yield from host_pool.release(connection)

        force = self.count() > self._max_count
        yield from self.clean(force=force)
701724
function(connection) {
      var t = this;
      log.info('removeConnection', 'Conn_' + connection.id);
      connection.disconnect('connection_removed');
      t.connections.remove(connection);
      t.trigger('connection:remove', connection);
    }
669027
public void release(Object o)
    {
        synchronized(this)
        {
            usedPool.remove(o);
            freePool.add(o);
            notify();
        }
    }
321239
public void free(Connection connection) {
        try {
            if (!connection.isClosed()){
                // ensure connections returned to pool as read-only
                setConnectionReadOnly(connection, true);
                connection.close();
            } else {
                logger.debug("Ignoring attempt to close a previously closed connection");
            }
        } catch (SQLException sqle) {
            logger.warn("Unable to close connection", sqle);
        } finally {
            if (logger.isDebugEnabled()) {
                logger.debug("Returned connection to pool (" + toString() + ")");
            }
        }
    }
1165819
public static void release(Statement statement, Connection connection) {

        if (statement != null) {
            try {
                statement.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

        if (connection != null) {
            JDBCUtils.release(connection);
        }
    }
575348
private static void release(Connection connection) {
        Connection con = tl_conn.get();
        try {
            // 若不是事务连接则直接关闭，若是事务连接不执行任何操作，事务连接由提交事务方法关闭
            if (con == null || con != connection) {
                connection.close();
            }

        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
93245
function(pool) {
    if (
      !connectionInCreation &&
      pool.idleConnections() < opts.minimumIdle &&
      pool.totalConnections() < opts.connectionLimit &&
      !closed
    ) {
      connectionInCreation = true;
      process.nextTick(() => {
        const timeoutEnd = Date.now() + opts.initializationTimeout;
        if (!closed) {
          connectionCreationLoop(pool, 0, timeoutEnd)
            .then(conn => {
              if (closed) {
                return conn.forceEnd().catch(err => {});
              }
              addPoolConnection(pool, conn);
            })
            .catch(err => {
              if (pool.totalConnections() === 0) {
                const task = taskQueue.shift();
                if (task) {
                  firstTaskTimeout = clearTimeout(firstTaskTimeout);
                  process.nextTick(task.reject, err);
                  resetTimeoutToNextTask();
                }
              } else if (!closed) {
                console.error(
                  `pool fail to create connection (${err.message})`
                );
              }

              //delay next try
              setTimeout(() => {
                connectionInCreation = false;
                if (taskQueue.size() > 0) {
                  ensurePoolSize(pool);
                }
              }, 500);
            });
        }
      });
    }
  }
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);
			}
		}
	}
378181
public void removeConnection(WebSocketConnection conn) {
        if (conn != null) {
            WebSocketScope scope = getScope(conn);
            if (scope != null) {
                scope.removeConnection(conn);
                if (!scope.isValid()) {
                    // scope is not valid. delete this.
                    removeWebSocketScope(scope);
                }
            }
        }
    }
1223529
public void removeConnectionPool(String host, int port) {
        RequestBuilder req = new RequestBuilder();
        req.host = host;
        req.port = port;
        removePool(req);
    }