<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Why am I still seeing the HouseKeepingMessage ?
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/mda_dk">Mads Moelgaard Andersen</a> in <i>Beginner's Corner</i> - <a href="http://community.jboss.org/message/557907#557907">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi</p><p>I keep getting this "HouseKeeping" message for both connections and statements. and I don't understand why.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>All my JDBC calls follow the same pattern:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-java"><font color="navy"><b>public</b></font> ArrayList&lt;ObjectScore&gt; getObjectIdsAndScore(<font color="navy"><b>long</b></font> someLong, <font color="navy"><b>long</b></font> anotherLong, <font color="navy"><b>long</b></font> aThirdLong, String aString) <font color="navy"><b>throws</b></font> Exception
&#160;&#160;&#160; <font color="navy">{</font>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160; ArrayList&lt;ObjectScore&gt; result = <font color="navy"><b>new</b></font> ArrayList&lt;ObjectScore&gt;(500000);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; ResultSet rs = <font color="navy"><b>null</b></font>;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>try</b></font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">{</font>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Connection conn = getConnection();
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; StringBuffer sql = <font color="navy"><b>new</b></font> StringBuffer();
&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; *** BUILDING SOME SQL ***&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rs = executeSelect(conn, sql.toString(), fetchsize);
&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rs.beforeFirst();
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>while</b></font> (rs.next())
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; result.add(<font color="navy"><b>new</b></font> ObjectScore( rs.getLong(1), rs.getFloat(2)));
&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; result.trimToSize();
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font> 
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>catch</b></font> (Exception e)
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">{</font>&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; logger.error(<font color="red">"getObjectIdsAndScore failed: "</font>+e.getMessage());
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>throw</b></font> e;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>finally</b></font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>try</b></font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>if</b></font> (rs.getStatement() != <font color="navy"><b>null</b></font>) rs.getStatement().close();
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>catch</b></font> (Exception ignored) 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>try</b></font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>if</b></font> (rs != <font color="navy"><b>null</b></font>) rs.close();
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rs = <font color="navy"><b>null</b></font>;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>catch</b></font> (Exception ignored) 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; closeConnection(); 
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>return</b></font> result;
&#160;&#160;&#160; <font color="navy">}</font>
</code></pre><p>Both getConnection() and closeConnection() are inherited methods.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-java"><font color="navy"><b>public</b></font> ResultSet executeSelect(Connection connection, String sql, <font color="navy"><b>int</b></font> fsize) <font color="navy"><b>throws</b></font> Exception
&#160;&#160;&#160; <font color="navy">{</font>&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160; ResultSet rs = <font color="navy"><b>null</b></font>;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>try</b></font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">{</font>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sql = (sql.endsWith(<font color="red">";"</font>) ? sql.substring(0, sql
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .length() - 1) : sql);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; logger.info(<font color="red">"SQL: "</font> + sql);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Statement statement = connection.createStatement(
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ResultSet.TYPE_SCROLL_INSENSITIVE,
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ResultSet.CONCUR_READ_ONLY);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; statement.setFetchSize(fsize);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rs = statement.executeQuery(sql);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font> 
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>catch</b></font> (Exception e)
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; logger.error(<font color="red">"executeSelect failed: "</font>+e.getMessage());
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>throw</b></font> e;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>finally</b></font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">{</font>
&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>return</b></font> rs;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160; <font color="navy">}</font>&#160;&#160; 
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">14:01:47,320 WARN&#160; [WrappedConnection] Closing a result set you left open! Please close it yourself.
java.lang.Throwable: STACKTRACE
&#160;&#160;&#160; at org.jboss.resource.adapter.jdbc.WrappedStatement.registerResultSet(WrappedStatement.java:744)
&#160;&#160;&#160; at org.jboss.resource.adapter.jdbc.WrappedStatement.executeQuery(WrappedStatement.java:217)
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Pointing out the method for the first snippet.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I also get following when a MDB exits the onMessage method.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">[CachedConnectionManager] Closing a connection for you.&#160; Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@844674
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I've already read</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a class="" href="http://community.jboss.org/wiki/WhatDoesTheMessageDoYourOwnHousekeepingMean">http://community.jboss.org/wiki/WhatDoesTheMessageDoYourOwnHousekeepingMean</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>and I guess my code pretty much follow the outlined pattern, so what is wrong?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Best regards</p><p>Mads M Andersen</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/557907#557907">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Beginner's Corner at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>