[英]Correct stop java application with IBM mq
I use java application with IBM mq websphere. 我将Java应用程序与IBM mq websphere一起使用。 When i am killing the application in mq is remained some information about channels.
当我杀死mq中的应用程序时,仍然保留一些有关渠道的信息。 I don't know way to correct stopping of application.
我不知道纠正应用程序停止的方法。
Simply put, i need kill application with mq channels. 简单地说,我需要使用mq通道终止应用程序。 Because when i restart application, it can't start and throw exception:
因为当我重新启动应用程序时,它无法启动并引发异常:
ERROR Failed to initialize Queue Channel.
com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: Failed to connect to queue manager 'TL4UZ8T' with connection mode '1' and host name 'mq4u-TL4UZ8T.lb.com(64424)'.
Thanks for helping! 感谢您的帮助!
Boy! 男孩! why you have to kill application?
为什么您必须终止应用程序? Do you mean abnormal termination of application?
您的意思是申请异常终止吗?
The application must call Disconnect() to inform the queue manager to do clean up it's end. 应用程序必须调用Disconnect()来通知队列管理器进行清理。 It's a best practice, please read other best practices here .
这是最佳做法,请在此处阅读其他最佳做法。 If Disconnect is not called, queue manager does not immediately clean up resources allocated for a client connection.
如果未调用Disconnect,则队列管理器不会立即清除为客户端连接分配的资源。
So check your application code and ensure it has code to close any queues/topics/connections opened. 因此,请检查您的应用程序代码,并确保它具有关闭打开的所有队列/主题/连接的代码。
To expand on Shashi's excellent answer, there are lots of things you can consider here. 为了扩展Shashi的出色答案,您可以在这里考虑很多事情。 For example:
例如:
MODE(INACTIVE)
so the app can reconnect. MODE(INACTIVE)
以便应用程序可以重新连接。 HBINT
, SHARECONV
, KEEPALIVE
and other parameters so that the channel has lots of spare instances and that the orphaned instances shut down in a timely fashion. HBINT
, SHARECONV
, KEEPALIVE
和其他参数,以便该通道具有许多备用实例,并且孤立实例会及时关闭。 This may include bumping up the listener backlog as well. SIGHUP
or other system signal to shut itself down gracefully. SIGHUP
或其他系统信号以正常关闭自身。 As Shashi notes, the best option is that the application communicates it's desire to shut down to the QMgr and the two cooperate to accomplish that task. 正如Shashi所指出的,最好的选择是应用程序传达它希望关闭QMgr的信息,并且两者共同完成该任务。 The app is built to cooperate with MQ on every other task, so why not this one?
该应用程序旨在与MQ合作完成其他所有任务,那么为什么不这样做呢?
However, if that isn't an option use the instrumentation built into MQ to accomplish as close as possible to the desired result. 但是,如果不是这样,则可以使用MQ内置的工具来尽可能地接近期望的结果。
Failing that, use the instrumentation built into the OS but tune MQ to minimize the impact. 失败的话,请使用操作系统内置的工具,但要调整MQ以最大程度地减少影响。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.