I am developing IBM MQ Connection pool using Apache commons pool (2.4.2 ). IBM MQ JAR version 8.
As part of Pool concept , I need to validate the connection before return to program.
Help me on how to validate IBM MQ connection ?
Java 8
IBM MQ 8
Apache commons pool 2.4.2
JMS 2.0
I assume you are using version 2 of Commons pool. To validate instances before delivering them to pool clients, you need to:
valiateObject()
in yourPooledObjectFactory
.testOnBorrow
and / ortestOnCreate
property totrue
.Setting
testOnBorrow
to true causes instances to be validated each time they are borrowed from the pool.testOnCreate
(new in Pool 2) validates only once, when the instance is created.