@Override
  public void releaseClient(CassandraConnectionHandle conn) throws SQLException {
    boolean open;
    try {
      open = !conn.isClosed();
    } catch (SQLException e) {
      // Tight to Cassandra Driver implementation. It should not happen.
      open = false;
    }

    if (open) {
      if (active.get()) {
        addClientToPoolGently(conn);
      } else {
        log.info("Open client released to in-active pool for host {}. Closing.", cassandraHost);
        closeConnection(conn);
      }
    } else {
      try {
        addClientToPoolGently(createConnection());
      } catch (SQLException e) {
        log.info("Unable to reopen a connection. Bad server. Message: " + e.getMessage());
      }
    }

    realActiveConnectionCount.decrementAndGet();
    activeConnectionCount.decrementAndGet();

    if (log.isDebugEnabled()) {
      log.debug("Status of releaseClient {} to queue: {}", cassandraHost.getHost(), open);
    }
  }
 private void closeConnection(CassandraConnectionHandle conn) {
   try {
     conn.getInternalConnection().close();
   } catch (SQLException e) {
     log.error("Error closgin connection for: " + cassandraHost.getHost());
   }
 }