ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » How to gracefully shutdown connection pooling

Post new topic  Reply to topic
 How to gracefully shutdown connection pooling « View previous topic :: View next topic » 
Author Message
Nikitich
PostPosted: Wed Nov 23, 2011 12:18 am    Post subject: How to gracefully shutdown connection pooling Reply with quote

Newbie

Joined: 26 Jan 2010
Posts: 7

Hi,

Problem
When shutting down my app:
- that uses MQ v. 6.0.2.6 (both JMS and IBM MQ API client),
- deployed in Tomcat (6+),
- with Spring (3+),
- with MQSimpleConnectionManager for connection pooling, as the default one,

I am getting Tomcat's:
"SEVERE: The web application [...] appears to have started a thread named [PoolScavenger0] but has failed to stop it."

Questions
(a) How do I gracefully shutdown pool of connections in a servlet container?
(b) What could possibly be the reason of the hanging threads (originating from IBM MQ lib), eventually causing memory leak, as reported by Tomcat?
(c) What happens when there is a request in progress with a PoolToken in use, while admin shuts down web container?

I get my connection pool as follows:
- Created MQSimpleConnectionManager;
- Set it as the default one with MQEnvironment;

Thank you.
-
N
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Nov 23, 2011 11:02 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Sorry you got it all wrong. You should never mix the 2 java programming models. Either go all JMS, or go all java base.

And update at least to 6.0.2.10
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Nikitich
PostPosted: Wed Nov 23, 2011 6:30 pm    Post subject: Reply with quote

Newbie

Joined: 26 Jan 2010
Posts: 7

fjb_saper,

Thank you for your input.
Will follow.

Code change, MQ FixPack/version update/upgrade however will take some time here to happen.
In the meantime it is an issue to deal with.

- Do you see a way to force the sockets to get closed; those originating from the pool?
I could probably live with the hanging Timer threads.
I'd prefer to avoid hanging connections affecting the server side.

I can get control prior to Tomcat's ultimate shutdown event.
Would it be possible to issue (to call MQ object's method) at that moment, something like:
- Whatever pool has been registered with MQEnvironment object, please shut it down and nicely ?

Thanks.
-
N.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Nov 23, 2011 6:35 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Nikitich wrote:
fjb_saper,

Thank you for your input.
Will follow.

Code change, MQ FixPack/version update/upgrade however will take some time here to happen.
In the meantime it is an issue to deal with.

- Do you see a way to force the sockets to get closed; those originating from the pool?
I could probably live with the hanging Timer threads.
I'd prefer to avoid hanging connections affecting the server side.

I can get control prior to Tomcat's ultimate shutdown event.
Would it be possible to issue (to call MQ object's method) at that moment, something like:
- Whatever pool has been registered with MQEnvironment object, please shut it down and nicely ?

Thanks.
-
N.


If you are on V7 you really should be on V7.0.1.6 (lots of fixes in JMS)
As for shutting down gracefully a connection pool, the only right and safe way I know is have the application that uses those connections release them correctly back to the pool, once it is done using them....

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Nikitich
PostPosted: Wed Nov 23, 2011 7:14 pm    Post subject: Reply with quote

Newbie

Joined: 26 Jan 2010
Posts: 7

Good to know about v.7+, thanks.

My last one, I hope.
You mentioned earlier that mixing the two modes: JMS with IBM MQ Java API is not a good idea: "...You should never mix..."

Do you think that with v.7.0+ it is still true?

If 'Yes' - Why?
- the same product; no warnings in the RedBooks (have I missed them?)

Not asking for your extra time to explain; just few words.
Thank you.

-
N
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Nov 24, 2011 12:19 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

If you are using JMS you are hopefully in a J2EE environment and MQ JMS has been optimized for that environment. So why would you try and use Java base and rebuild the wheel to use it efficiently.

As for not mixing, the temptation is always great to use and object from java base in JMS or vice versa. This will not work. The two interfaces are not intermixable, though you might consider them to be interchangeable.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Nikitich
PostPosted: Sat Nov 26, 2011 6:56 pm    Post subject: Reply with quote

Newbie

Joined: 26 Jan 2010
Posts: 7

I had no issues with JMS based listeners.
It is just about the MQSimpleConnectionManager - the managing Timer thread left hanging, as well as pooled connections.

As a temporary solution I came to the following.
Prior to Tomcat getting shutdown I make the number of unused connection =0 and then set MQSimpleConnectionManager to MODE_INACTIVE.
No more hanging connections; I can live with the managing Timer thread on the client side for awhile.

fjb_saper, thank you.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » How to gracefully shutdown connection pooling
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.