/*
(non-Javadoc)

@see
com.impetus.client.cassandra.CassandraClientBase#releaseConnection(java
.lang.Object)
552035
protected void releaseConnection(Object conn)
    {
        clientFactory.releaseConnection(((Connection) conn).getPool(), ((Connection) conn).getClient());
    }
1223819
func (l *ConnectionsLimiter) ReleaseConnection(token string) {

	l.Lock()
	defer l.Unlock()

	if l.maxConnections == 0 {
		return
	}

	numberOfConnections, exists := l.connections[token]
	if !exists {
		log.Errorf("Trying to set negative number of connections")
	} else {
		if numberOfConnections <= 1 {
			delete(l.connections, token)
		} else {
			l.connections[token] = numberOfConnections - 1
		}
	}
}
551350
private void release(PooledConnection<C> pooledConnection) {
		long currentTime = System.currentTimeMillis();
		long useTime;
		synchronized(pooledConnection) {
			pooledConnection.releaseTime = currentTime;
			useTime = currentTime - pooledConnection.startTime;
			if(useTime>0) pooledConnection.totalTime.addAndGet(useTime);
			pooledConnection.allocateStackTrace = null;
		}
		// Remove from the pool
		synchronized(poolLock) {
			try {
				if(busyConnections.remove(pooledConnection)) availableConnections.add(pooledConnection);
			} finally {
				poolLock.notify();
			}
		}
	}
301592
def release(self, connection: Connection, reuse: bool=True):
        '''
        '''
        yield from self._condition.acquire()
        self.busy.remove(connection)

        if reuse:
            self.ready.add(connection)

        self._condition.notify()
        self._condition.release()
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);
    }
1023201
@Override
    public void release() {
	params.clear();
	results.clear();
	returnValue = null;
	procedure = null;
	datasource = null;
	username = null;
	password = null;
	blockfactor = -1;
	timeout = -1;
	debug = true;
	returncode = false;
	result = "cfstoredproc";

	cachedWithin = null;
	cachedafter = null;
	// cachename="";

	super.release();
    }
138206
@Override
	public void connectionFreed(IManagedConnectionEvent<C> event) {
		// physical connection is already set free
		if (!event.getManagedConnection().hasCoreConnection()) {
			return;
		}
		C con = event.getManagedConnection().getCoreConnection();
		if (con == null || !(con instanceof IXADataRecorderAware)) {
			return;
		}

		IXADataRecorderAware messageAwareConnection = (IXADataRecorderAware) con;
		// Transaction is closed and the xaDataRecorder is destroyed ...
		IXADataRecorder xaDataRecorder = messageAwareConnection
				.getXADataRecorder();
		if (xaDataRecorder == null) {
			return;
		}

		// if commit/rollback was performed, nothing happend. If no the logged
		// data is closed but not destroy. So recovery can happen

		if (event.getManagedConnection().hasTransactionalData()) {
			xaRecorderRepository.close(); // close without removing the recover
											// data
		} else {
			xaDataRecorder.destroy();
		}
		messageAwareConnection.setXADataRecorder(null);

	}
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);
        }
    }
545765
@Override
  public void release() throws CpoException {
    for (CpoReleasible releasible : releasibles) {
      try {
        releasible.release();
      } catch (CpoException ce) {
        logger.error("Error Releasing Callable Statement Transform Object", ce);
        throw ce;
      }
    }
  }
748702
@Override
    public void releaseConnection() {
        if (apacheHttpResponse != null) {
            try {
                apacheHttpResponse.close();
                apacheHttpResponse = null;
            } catch (IOException e) {
                logger.error("error closing Apache HttpResponse - {}", e);
            }
        }
    }
619512
public void removeConnectionEventListener(
            final ConnectionEventListener listener) {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "removeConnectionEventListener", listener);
        }

        _eventListeners.remove(listener);

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, "removeConnectionEventListener");
        }

    }
120839
@Override
    protected Object createPoolOrConnection()
    {
        PersistenceUnitMetadata persistenceUnitMetadata = kunderaMetadata.getApplicationMetadata()
                .getPersistenceUnitMetadata(getPersistenceUnit());

        Properties props = persistenceUnitMetadata.getProperties();
        String keyspace = null;

        if (externalProperties != null)
        {
            keyspace = (String) externalProperties.get(PersistenceProperties.KUNDERA_KEYSPACE);
        }

        if (keyspace == null)
        {
            keyspace = (String) props.get(PersistenceProperties.KUNDERA_KEYSPACE);
        }

        for (Host host : ((CassandraHostConfiguration) configuration).getCassandraHosts())
        {
            PoolConfiguration prop = new PoolProperties();
            prop.setHost(host.getHost());
            prop.setPort(host.getPort());
            prop.setKeySpace(keyspace);

            CassandraUtilities.setPoolConfigPolicy((CassandraHost) host, prop);
            try
            {
                ConnectionPool pool = new ConnectionPool(prop);
                hostPools.put(host, pool);
            }
            catch (TException e)
            {
                logger.warn("Node {} are down, Caused by {} .", host.getHost(), e.getMessage());
                if (host.isRetryHost())
                {
                    logger.warn("Scheduling node for future retry");
                    ((CassandraRetryService) hostRetryService).add((CassandraHost) host);
                }
            }
        }
        return null;
    }
358044
public Closeable onConnectionStateChange(final Consumer<BitfinexConnectionStateEnum> listener) {
        connectionStateConsumers.offer(listener);
        return () -> connectionStateConsumers.remove(listener);
    }
1014788
@Override
    public void release() {
	super.release();
	this.pool = null;

	this.action = null;
	this.username = null;
	this.password = null;
	this.server = null;
	this.timeout = 30;
	this.port = -1;
	this.connectionName = null;
	this.proxyserver = null;
	this.proxyport = 80;
	this.proxyuser = null;
	this.proxypassword = "";
	this.retrycount = 1;
	this.count = 0;
	this.stoponerror = true;
	this.passive = false;
	this.name = null;
	this.directory = null;
	this.ASCIIExtensionList = ASCCI_EXT_LIST;
	this.transferMode = FTPConstant.TRANSFER_MODE_AUTO;
	this.remotefile = null;
	this.localfile = null;
	this.failifexists = true;
	this.existing = null;
	this._new = null;
	this.item = null;
	this.result = null;

	this.fingerprint = null;
	this.secure = false;
	this.recursive = false;
	this.key = null;
	this.passphrase = "";
    }
924262
public void release() 
    {
    	IPhynixxManagedConnection<C> con= this.connection;
        if (connection != null) {
            this.connection.removeConnectionListener(this);
        }
        this.connection = null;
        
        // return con; 
    }
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");
        }

    }
730581
void release(DatasourceConnection dc) {
	if (dc != null) {

	    try {
		dc.getConnection().commit();
		dc.getConnection().setAutoCommit(true);
		dc.getConnection().setTransactionIsolation(Connection.TRANSACTION_NONE);
	    }
	    catch (SQLException e) {}

	    getManager().releaseConnection(ThreadLocalPageContext.get(), dc);
	}
    }