简体   繁体   English

如何验证池的IBM MQ连接

[英]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: 为了在将实例交付给池客户端之前验证实例,您需要:

  1. Implement valiateObject() in your PooledObjectFactory . PooledObjectFactory实现valiateObject()
  2. Set the pool's 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.

相关问题 两个简单的 IBM MQ 客户端测试写入 MQ 队列 - 为什么一个有效,而另一个无效? - Two simple IBM MQ client tests write to MQ queue - why does one work, but, NOT the other? NoClassDefFoundError 无法初始化类 com.ibm.mq.headers.internal.HeaderType - NoClassDefFoundError Could not initialize class com.ibm.mq.headers.internal.HeaderType JBoss Fuse/REST DSL - 为什么我的修改(使用 IBM MQ)不起作用? - JBoss Fuse/REST DSL - Why do my modifications (to use IBM MQ) not work? 连接池已达到最大大小 - Connection pool has reached its maximum size 我们可以将我的Java-Spring-mvc服务连接到IBM MQ而不用从队列中生成或使用绑定文件吗? - can we connect my Java-Spring-mvc service to IBM MQ without generating or using binding files from the queues Oracle 数据库连接未从 Tomcat 中的连接池释放 8 - Oracle DB connections not releasing from connection pool in Tomcat 8 如何使用线程池读取多个文件? - How to read multiple files using thread pool? 连接到MQ管理器会收到MQ错误2495 - Connecting to MQ manager get MQ error 2495 如何验证和修复URL中无效的斜杠数量? - How to validate and fix invalid number of slashes in URL? 如何验证Java 8 Stream中有两个特定元素? - How to validate that a Java 8 Stream has two specific elements in it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM