Author |
Message
|
dustoff |
Posted: Tue Oct 12, 2004 12:43 pm Post subject: MQQueueManager will not disconnect until waitInterval done |
|
|
Newbie
Joined: 12 Oct 2004 Posts: 9
|
Looking for advice.
My MQQueueManager will not disconnect until the waitInterval that I set (60 seconds ) has completed on the get().
I studied this forum and applied the MQC.MQOO_FAIL_IF_QUIESCING option that was shown to be the problem in other similiar situations.
Still having the problem.
Have MQSeries for Java v5.2.2
Here is my code for the open:
Code: |
MQEnvironment.hostname = this.outHost;
MQEnvironment.port = this.outPort;
MQEnvironment.channel = this.outChannel;
mgr = new MQQueueManager( this.outMgrName );
out = mgr.accessQueue( this.outQueueName, MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING, null, null, null );
|
Thanks!
Any suggestions is appreciated!
dustoff |
|
Back to top |
|
 |
dustoff |
Posted: Tue Oct 12, 2004 12:51 pm Post subject: |
|
|
Newbie
Joined: 12 Oct 2004 Posts: 9
|
<idiot>
In my original posting I grabbed the wrong code, which was for the output queue which I was expirementing with. Posted below is code for creating the input queue. Sorry for any confusion.
</idiot>
Code: |
MQEnvironment.hostname = this.inHost;
MQEnvironment.port = this.inPort;
MQEnvironment.channel = this.inChannel;
mgr = new MQQueueManager( this.inMgrName );
in = mgr.accessQueue( this.inQueueName, MQC.MQOO_INPUT_SHARED | MQC.MQOO_FAIL_IF_QUIESCING, null, null, null );
|
|
|
Back to top |
|
 |
vennela |
Posted: Tue Oct 12, 2004 12:52 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
What is your problem?????
Are you wanting not to wait for 60 seconds... then change the wait time. |
|
Back to top |
|
 |
siliconfish |
Posted: Tue Oct 12, 2004 12:53 pm Post subject: |
|
|
 Master
Joined: 12 Aug 2002 Posts: 203 Location: USA
|
If you set the wait interval on get to 60 sec, GET will wait untill the end of 60 sec and then completes the call - it will not "disconnect" from the queue manager.
MQC.MQOO_FAIL_IF_QUIESCING applies to the situation in which the queue manager is Quiescing.
Quote: |
If the queue manager enters the quiescing state, and you used the MQGMO_FAIL_IF_QUIESCING option, the wait is canceled and the MQGET call completes with the MQRC_Q_MGR_QUIESCING reason code. Without this option, the call remains waiting. |
_________________ siliconfish |
|
Back to top |
|
 |
dustoff |
Posted: Tue Oct 12, 2004 12:54 pm Post subject: |
|
|
Newbie
Joined: 12 Oct 2004 Posts: 9
|
vennela wrote: |
What is your problem?????
Are you wanting not to wait for 60 seconds... then change the wait time. |
I don't want to wait up to 60 seconds to disconnect.
Thanks! |
|
Back to top |
|
 |
vennela |
Posted: Tue Oct 12, 2004 1:07 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Post the code where you do the get
I do this and the program never waits if there is no message
Code: |
MQMessage outMessage = new MQMessage();
outQueue.get(outMessage); |
|
|
Back to top |
|
 |
dustoff |
Posted: Tue Oct 12, 2004 1:09 pm Post subject: |
|
|
Newbie
Joined: 12 Oct 2004 Posts: 9
|
The problem that I am having is that when I want to restart my Tomcat server, I use a ServletContextListener that attempts to shutdown the MQQueueManager. When I perform MQQueueManager.disconnect() this thread hangs on the disconnect until the MQQueue.get() completes its wait interval.
I would prefer to not decrease the waitInterval. To me that would seem like kludging what I am trying to do. There should be a provision in MQQueueManager to disconnect immediately, which is what the fail_if_quiescing option, from my understanding, is suppose to do.
Hope that clarifies. Thanks! |
|
Back to top |
|
 |
dustoff |
Posted: Tue Oct 12, 2004 1:14 pm Post subject: |
|
|
Newbie
Joined: 12 Oct 2004 Posts: 9
|
Here is my get routine:
Code: |
public MQMessage get() throws MQException {
MQMessage msg = new MQMessage();
try {
MQGetMessageOptions msgOptions = new MQGetMessageOptions();
msgOptions.options = MQC.MQGMO_WAIT;
msgOptions.waitInterval = 60000;
in.get( msg, msgOptions, 2000 );
} catch (MQException ex) {
if ( ex.reasonCode != 2033 ) {
this.isInOpen = false;
throw ex;
}
}
return msg;
}
|
|
|
Back to top |
|
 |
bower5932 |
Posted: Tue Oct 12, 2004 1:25 pm Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
Why don't you send yourself a terminate message? You can do it before issuing the disconnect. The get will retrieve the message and end which should allow the disconnect to complete. |
|
Back to top |
|
 |
EddieA |
Posted: Tue Oct 12, 2004 1:51 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
You need the FAIL_IF_QUIESCING on the GMO as well. That option only works on the call it is coded on, so setting it on the OPEN only has effect for the OPEN. Not subsequent calls.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
siliconfish |
Posted: Tue Oct 12, 2004 2:08 pm Post subject: |
|
|
 Master
Joined: 12 Aug 2002 Posts: 203 Location: USA
|
I don't think that any of the QUIESCING options work here, as the actual queue manager is not ending, its only the java queue manager object that is being disconnected. _________________ siliconfish |
|
Back to top |
|
 |
JLRowe |
Posted: Wed Oct 13, 2004 1:27 am Post subject: |
|
|
 Yatiri
Joined: 25 May 2002 Posts: 664 Location: South East London
|
You are blocked on a get on one thread, and are attempting to do a disconnect on another. All access to the queue manager is serialized, so your disconnect will wait until the get has finished.
I should think your only option is to reduce the wait interval. |
|
Back to top |
|
 |
dustoff |
Posted: Wed Oct 13, 2004 7:55 am Post subject: |
|
|
Newbie
Joined: 12 Oct 2004 Posts: 9
|
Everybody, thanks for your responses!
I am getting conflicting messages from the group though.
Some are saying that MQGMO_FAIL_IF_QUIESCING in the gmo options should solve my problem. However when I apply this, it still hangs on the MQQueueManager.disconnect(). At this point, it appears that jlrowe and siliconfish are correct in their judgments that input queue blocks on get().
Is it possible the FAIL_IF_QUIESCING does not work for MQSeries for Java?
I am leaning towards bower5932 suggestion of sending a terminate message to the queue.
I have never connected to my own client input queue. Do you just have to create a new queue manager pointint to localhost? Is there example code out there that demonstrates this. Sorry for being so naive, but have only connected to MQServer.
Thanks! |
|
Back to top |
|
 |
vennela |
Posted: Wed Oct 13, 2004 8:06 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Quote: |
If the queue manager enters the quiescing state, and you used the MQGMO_FAIL_IF_QUIESCING option, the wait is canceled and the MQGET call completes with the MQRC_Q_MGR_QUIESCING reason code. Without this option, the call remains waiting. |
When somebody does endmqm (to stop the QMGR) then the QMGR goes to QUIESCING mode. The QMGR will stop after all the outstanding work is done (your MQGET with wait mode is one such thing). Now if somebody tries to OPEN (or GET I think) with the option FAIL_IF_QUIESCING the call fails with MQRC_Q_MGR_QUIESCING.
BUT, if you have already issued MQGET, then MQGMO_FAIL_IF_QUIESCING will not help.
Quote: |
Some are saying that MQGMO_FAIL_IF_QUIESCING in the gmo options should solve my problem. |
You might have understood it that way but you got it wrong.
Quote: |
Is it possible the FAIL_IF_QUIESCING does not work for MQSeries for Java? |
It sure does but it will not solve your problem |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Oct 13, 2004 8:56 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
dustoff wrote: |
I have never connected to my own client input queue. Do you just have to create a new queue manager pointint to localhost? Is there example code out there that demonstrates this. |
You can find a sample (mqhash.java I believe) on:
http://www.developer.ibm.com/tech/sampmq.html
You put the connection information into a hash table and then issue the connect. |
|
Back to top |
|
 |
|