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 disconnect gracefully on killing a Java Application

Post new topic  Reply to topic
 How to disconnect gracefully on killing a Java Application « View previous topic :: View next topic » 
Author Message
tapak
PostPosted: Thu Nov 02, 2006 2:41 pm    Post subject: How to disconnect gracefully on killing a Java Application Reply with quote

Centurion

Joined: 26 Oct 2005
Posts: 149
Location: Hartford,CT

Is there a way to disconnect from MQ on killing the Java standalone application in Unix . When I kill a Java client application connecting to MQ ( using kill command in unix ) , the server connection channels still seems to be running. Is there a way to disconnect from MQ gracefully on killing the process.

Does the finalize method serve the purpose.?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Nov 02, 2006 3:48 pm    Post subject: Re: How to disconnect gracefully on killing a Java Applicati Reply with quote

Grand High Poobah

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

tapak wrote:
Is there a way to disconnect from MQ on killing the Java standalone application in Unix . When I kill a Java client application connecting to MQ ( using kill command in unix ) , the server connection channels still seems to be running. Is there a way to disconnect from MQ gracefully on killing the process.

Does the finalize method serve the purpose.?


If the JVM does a graceful shutdown the finalize method may be used to clean up all outstanding resources.

The proper way of your application should be to only keep the resource as long as it is truely needed, and to allow for some graceful shutdown...

If you need to kill -9 the JVM the only way to kill the resource is by checking the qmgr:
see queue status and display connection.

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
tapak
PostPosted: Fri Nov 03, 2006 6:45 am    Post subject: Reply with quote

Centurion

Joined: 26 Oct 2005
Posts: 149
Location: Hartford,CT

Hi fjb_saper,

Thanks for the info. You have explanations for all my problems with mq and Java. You are the best.
Back to top
View user's profile Send private message
tapak
PostPosted: Fri Nov 03, 2006 7:02 am    Post subject: Reply with quote

Centurion

Joined: 26 Oct 2005
Posts: 149
Location: Hartford,CT

Is there a way to gracefully shutdown the JVM for a standalone application.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Nov 03, 2006 2:48 pm    Post subject: Reply with quote

Grand High Poobah

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

tapak wrote:
Is there a way to gracefully shutdown the JVM for a standalone application.

Code:
System.exit(0); //from memory

But before calling this snippet I would try to clean up all resources
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
JLRowe
PostPosted: Wed Nov 08, 2006 3:03 am    Post subject: Reply with quote

Yatiri

Joined: 25 May 2002
Posts: 664
Location: South East London

Yes, the return statement!

tapak wrote:
Is there a way to gracefully shutdown the JVM for a standalone application.
Back to top
View user's profile Send private message Send e-mail
tapak
PostPosted: Wed Nov 08, 2006 8:38 am    Post subject: Reply with quote

Centurion

Joined: 26 Oct 2005
Posts: 149
Location: Hartford,CT

Sorry. I didnt made my question clear.

I am having a standalone java application started as a background process in Unix which listens to a queue . Is there a way to stop the application other than using kill -9 which will gracefully shutdown the JVM.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Nov 08, 2006 9:37 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Yes.

Write your program to accept a message that tells it to gracefully shut down.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
tapak
PostPosted: Wed Nov 08, 2006 10:59 am    Post subject: Reply with quote

Centurion

Joined: 26 Oct 2005
Posts: 149
Location: Hartford,CT

Thanks Jeff. That is a great idea.
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 disconnect gracefully on killing a Java Application
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.