Why am I still seeing the HouseKeepingMessage ?
mda_dk Aug 18, 2010 8:46 AMHi
I keep getting this "HouseKeeping" message for both connections and statements. and I don't understand why.
All my JDBC calls follow the same pattern:
public ArrayList<ObjectScore> getObjectIdsAndScore(long someLong, long anotherLong, long aThirdLong, String aString) throws Exception { ArrayList<ObjectScore> result = new ArrayList<ObjectScore>(500000); ResultSet rs = null; try { Connection conn = getConnection(); StringBuffer sql = new StringBuffer(); *** BUILDING SOME SQL *** rs = executeSelect(conn, sql.toString(), fetchsize); rs.beforeFirst(); while (rs.next()) result.add(new ObjectScore( rs.getLong(1), rs.getFloat(2))); result.trimToSize(); } catch (Exception e) { logger.error("getObjectIdsAndScore failed: "+e.getMessage()); throw e; } finally { try { if (rs.getStatement() != null) rs.getStatement().close(); } catch (Exception ignored) { } try { if (rs != null) rs.close(); rs = null; } catch (Exception ignored) { } closeConnection(); } return result; }
Both getConnection() and closeConnection() are inherited methods.
public ResultSet executeSelect(Connection connection, String sql, int fsize) throws Exception { ResultSet rs = null; try { sql = (sql.endsWith(";") ? sql.substring(0, sql .length() - 1) : sql); logger.info("SQL: " + sql); Statement statement = connection.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); statement.setFetchSize(fsize); rs = statement.executeQuery(sql); } catch (Exception e) { logger.error("executeSelect failed: "+e.getMessage()); throw e; } finally { } return rs; }
As you can see the first snippet opens and closes the connection. The second creates both the statement and the resultset where the first closes them both. Still I get WARNs like
14:01:47,320 WARN [WrappedConnection] Closing a result set you left open! Please close it yourself. java.lang.Throwable: STACKTRACE at org.jboss.resource.adapter.jdbc.WrappedStatement.registerResultSet(WrappedStatement.java:744) at org.jboss.resource.adapter.jdbc.WrappedStatement.executeQuery(WrappedStatement.java:217)
Pointing out the method for the first snippet.
I also get following when a MDB exits the onMessage method.
[CachedConnectionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@844674
I've already read
http://community.jboss.org/wiki/WhatDoesTheMessageDoYourOwnHousekeepingMean
and I guess my code pretty much follow the outlined pattern, so what is wrong?
Best regards
Mads M Andersen