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 » Connection Problem

Post new topic  Reply to topic
 Connection Problem « View previous topic :: View next topic » 
Author Message
jason_e
PostPosted: Tue Sep 30, 2003 3:43 am    Post subject: Connection Problem Reply with quote

Apprentice

Joined: 19 Aug 2003
Posts: 33

I'm using the base Java classes to connect to WebSphere MQ. If for some
reason my progie is unable to connect I would like it to retry until the
network connection is restored. Below is the code snippet I use to connect.

How would the best way to modify my app to retry the connection?

try {
qm = new MQQueueManager(QUEUEMANAGER, props);
q = qm.accessQueue(REMOTEQUEUE, openOptions, null, null, null);
} catch (MQException mqe) {
System.exit(-1);
} catch (Exception e) {
System.exit(-1);
}

Cheers
Jason
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Sep 30, 2003 5:46 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Code:

boolean retry = true;
while (retry)  {
   try {
        qm = new MQQueueManager(QUEUEMANAGER, props);
        q = qm.accessQueue(REMOTEQUEUE, openOptions,  null, null, null);
        retry = false;
   } catch (MQException mqe) {
       retry = true;
   } catch (Exception e) { {
       e.printStackTrace();
       System.exit(-1);
   }
}

_________________
I am *not* the model of the modern major general.
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 » Connection Problem
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.