Jboss:WhatDoesTheMessageDoYourOwnHousekeepingMean

It means you are not closing your connections to return them to the pool. To avoid connection leaks you should have code like the following:

Connection connection = dataSource.getConnection();
try
{
// DO WORK
}
finally
{
   try
   {
       connection.close();
   }
   catch (Throwable ignored)
   {
   }
}


For jdbc you should do the same thing for Statements and ResultSets?. Normally Statements are closed when the Connection is closed, but connection pooling means the close does not happen. Similarly, if you have prepared statements in a cache, ResultSets? need to be closed.


Thread Local Patterns

Many persistent frameworks (hibernate/ojb) open and close connections "at random". i.e. As far as JBoss is concerned it looks like one ejb allocated the connection and another closed it.

The connection close checking does not understand this behaviour. It expects the same ejb that allocated the connection to also close it.

If you use such a pattern, you can turn off this message (see below) but you are on your own when it comes to detecting connection leaks. From 3.2.6 there is a "listInUseConnections" on the CachedConnectionManager.


Turning off Connection Close Checking

In production you don't need this checking. Hopefully you have found all the connection leaks during development. You can turn it off on the CachedConnectionManager.

transaction-service.xml for 3.2.x
jbossjca-service.xml for 4.x

Change "Debug" to false.


  <mbean code="org.jboss.resource.connectionmanager.CachedConnectionManager"
         name="jboss.jca:service=CachedConnectionManager">
    <depends optional-attribute-name="TransactionManagerServiceName">jboss:service=TransactionManager</depends>

    <!-- Enable connection close debug monitoring -->
    <attribute name="Debug">false</attribute>

你可能感兴趣的:(xml,Hibernate,jboss,jdbc,ejb)