[jboss-user] [Beginner's Corner] - Why am I still seeing the HouseKeepingMessage ?
Mads Moelgaard Andersen
do-not-reply at jboss.com
Wed Aug 18 08:47:35 EDT 2010
Mads Moelgaard Andersen [http://community.jboss.org/people/mda_dk] created the discussion
"Why am I still seeing the HouseKeepingMessage ?"
To view the discussion, visit: http://community.jboss.org/message/557907#557907
--------------------------------------------------------------
Hi
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 at 844674
I've already read
http://community.jboss.org/wiki/WhatDoesTheMessageDoYourOwnHousekeepingMean 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
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/557907#557907]
Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100818/a106e470/attachment.html
More information about the jboss-user
mailing list