workingReferences.add(result);
    synchronized XCachablePreparedStatement take(Connection connection)         throws SQLException     {        if (sql == null)            throw new IllegalStateException(                "This reference guard was already destroyed.");        try {            XCachablePreparedStatement result;            if (!CACHE_PREPARED_STATEMENTS)                result = owner.prepareStatement(                    sql, resultSetType, resultSetConcurrency);            else {                if (freeReferences.isEmpty()) {                    if (LOG_STATEMENT_IN_POOL)                        logChannel.info(                            "Found no free prepared statements, " +                             "preparing new one.");                    result = owner.prepareStatement(                        sql, resultSetType, resultSetConcurrency);                } else {                    if (LOG_STATEMENT_IN_POOL)                        logChannel.info(                            "Found free prepared statement in pool.");                        result = (XCachablePreparedStatement)freeReferences.take();                }            }                        result.setConnection(connection);            return result;        } catch(InterruptedException iex) {            throw new SQLException("Cannot prepare SQL statement in pool");        }    }