[英]How to validate IBM MQ connection for Pool
I am developing IBM MQ Connection pool using Apache commons pool (2.4.2 ). 我正在使用Apache公共池(2.4.2)开发IBM MQ连接池。 IBM MQ JAR version 8.
IBM MQ JAR版本8。
As part of Pool concept , I need to validate the connection before return to program. 作为Pool概念的一部分,我需要在返回程序之前验证连接。
Help me on how to validate IBM MQ connection ? 帮助我如何验证IBM MQ连接?
Java 8
IBM MQ 8
Apache commons pool 2.4.2
JMS 2.0
I assume you are using version 2 of Commons pool. 我假设您正在使用Commons Pool的版本2。 To validate instances before delivering them to pool clients, you need to:
为了在将实例交付给池客户端之前验证实例,您需要:
valiateObject()
in your PooledObjectFactory
. PooledObjectFactory
实现valiateObject()
。 testOnBorrow
and / or testOnCreate
property to true
. testOnBorrow
和/或testOnCreate
属性设置为true
。 Setting testOnBorrow
to true causes instances to be validated each time they are borrowed from the pool. 将
testOnBorrow
设置为true会使每次从池中借用实例时都要对其进行验证。 testOnCreate
(new in Pool 2) validates only once, when the instance is created. 创建实例时,
testOnCreate
(池2中的新增功能)仅验证一次。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.