We have a vendor framework that currently opens and closes an MQSeries connection for each request. We'd like to run a proof of concept pooling these connections to see if we get a useful performance gain. I have no problem making an object pool, but I'm concerned that at server shutdown we may leave a lot of connections open on the QueueManager end.
Is there a shutdown event in the EJB container that I can use as a trigger to close all the connections in my pool? Or a better idea entirely?
Do you know any specific MQ connection pooling solutions?
This is WebSphere 5.0.1, *not* Enterprise. I think some of this is built into the Enterprise version, but we're not there for some reason.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
posted 10 years ago
Without being a WAS expert I can provide you two hints: one is to use JMX and MBeans. I know you can develop listener classes that can listen for notification when the state of an MBean changes. For example you can locate any of the runtime MBeans and check whether the server is running or not. Another idea is to use a similar approach with the way the container implements connection pooling. In a nutshell you can write a simple method that checks if the connection is healthy and do the check in order to retrieve/return the connection to the pool. This way you can make sure that your clients get only available connections. I hope this will help. Regards.