When an application is managing itself the access to the database through JDBC Datasources, the release of JDBC resources needs to be done. In some cases, the close of the connection is not done. As the JOnAS application server is using a pool to manage these accesses to the database, it means that the pool may reach its maximum size as the connections are not closed (and then put back into the pool). And if the pool reach its maximum size, new requests will go in the wait state or wll be aborted. Thus, this kind of problems is a huge problem in a production system.
Fortunately, there are some features provided by JOnAS to handle this case.
max-opentime
parameter of the JDBC RA
or datasources.
JDBC JNDI interceptors can be enabled by both:
jndi-intercept
service in the jonas.services
property of the $JONAS_BASE/conf/jonas.properties
file.-jndi-interceptor
option in the jonas start
command line.JOnAS provides some monitoring informations on JDBC connections available from the JMX interface. The MBean names varies depending whether the JDBC datasource was configured with the dbm service (properties file) or the resource service (Resource Adapter or JCA connector) :
jonas:j2eeType=JDBCDataSource,name=mydatasource,*
for a MBean related to a dbm configurationjonas:j2eeType=JCAConnectionFactory,name=mydatasource,*
for a MBean related to a RA configurationThese MBeans provides the following operations:
getOpenedConnections(int openDurationSec)
gets a list of opened physical connections being used for more than a given amount of time in sec (default is 30 sec).getConnectionDetails(int connectionId)
gets detailed informations about a specified connection such as age.forceClose(int connectionId)
attempts to force an opened physical connections to be destroyed.Additionable informations such as the stack trace of the thread getting the connection can be provided. For that, the observable
attribute of the JDBC datasource' MBean must be set to true
at runtime. You can use a JMX console or the JASMINe mbeancmd tool for accessing to the MBeans.