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 » Channels remaining open on Queue Manager

Post new topic  Reply to topic
 Channels remaining open on Queue Manager « View previous topic :: View next topic » 
Author Message
_Angus_
PostPosted: Tue Oct 10, 2006 3:49 am    Post subject: Channels remaining open on Queue Manager Reply with quote

Acolyte

Joined: 25 Apr 2005
Posts: 54
Location: Edinburgh

Hi there,

A team I'm helping have a problem where channels remain open on the Queue Manager after they have (seemingly) been closed properly by the client.

I don't know enough about JMS to spot this one but know something isn't tidying up properly. We are using MQ 5.3 CSD11 and the offending code is as follows:

----------------------------------------------------------------

private String sendMessage(String message, String jmsType) throws NamingException, JMSException
{
log.info("Encrypted Request: " + removeRestrictedLoggingElements(message));
//log.info("Request: " + message);
if(message.indexOf("<name>validateAndPriceOrder") != -1) {
log.debug("validateAndPriceOrder message.");
validateAndPriceOrderMessage = true;
}

InitialContext ic = new InitialContext();

QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory)ic.lookup(ApiConstants.QUEUE_FACTORY);
Queue queue = (Queue)ic.lookup(ApiConstants.SEND_QUEUE);
Queue receiveQueue = (Queue)ic.lookup(ApiConstants.RECEIVE_QUEUE);

QueueConnection connection = queueConnectionFactory.createQueueConnection();

try
{
connection.start();
//Create a queue session
QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

try{
//Send the message
QueueSender sender = session.createSender(queue);
try
{
TextMessage textMessage = session.createTextMessage(message);

// Default: Set the priority of message to 5
textMessage.setJMSPriority(5);
// Set the reply to queue
textMessage.setJMSReplyTo(receiveQueue);
// Set the domain to 'xml' and the type to jmsType
textMessage.setJMSType("mcd://xml//" + jmsType);
// Set a usr property
textMessage.setStringProperty("ErrorCode", "00000000");
//Send the message
sender.send(textMessage);

//Get the message id, this is used to filter the
//subsequent read of the reply to queue
String messageId = textMessage.getJMSMessageID();

return messageId;
}finally{
sender.close();
}
}finally{
session.close();
}
}
finally
{
connection.close();
}

}

---------------------------------------------------

Any help or pointers would be appreciated!

Angus
_________________
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Angus Cooke ~ AngusSoft

Integration Development Tools
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
jefflowrey
PostPosted: Tue Oct 10, 2006 4:52 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Are you running in an App Server?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
_Angus_
PostPosted: Tue Oct 10, 2006 5:22 am    Post subject: Reply with quote

Acolyte

Joined: 25 Apr 2005
Posts: 54
Location: Edinburgh

Yes, it is ...
_________________
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Angus Cooke ~ AngusSoft

Integration Development Tools
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
jefflowrey
PostPosted: Tue Oct 10, 2006 6:31 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Then your app server is going to establish connections when it starts up, and hold those open as long as the app server runs.

That's it's job, to manage these connections for your application, and to prevent your application from having to wait for the connection to be established and then wait for the connection to be closed.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
_Angus_
PostPosted: Tue Oct 10, 2006 7:03 am    Post subject: Reply with quote

Acolyte

Joined: 25 Apr 2005
Posts: 54
Location: Edinburgh

I understand that. But what we see is that, under load, new channels are spawned on the Queue Manager until it runs out of resource (ie. can't open any more channels!).
_________________
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Angus Cooke ~ AngusSoft

Integration Development Tools
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
fjb_saper
PostPosted: Tue Oct 10, 2006 2:33 pm    Post subject: Reply with quote

Grand High Poobah

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

_Angus_ wrote:
I understand that. But what we see is that, under load, new channels are spawned on the Queue Manager until it runs out of resource (ie. can't open any more channels!).


That would be because your application is not well behaved and does not always close/release correctly the resources ?

In each of your finally blocks I would have put something like
Code:

finally{
  try{
     object.close();
  }catch (JMSException jmse){
    //handle the exception
  } finally {
     object = null;
  }//end finally (internal)
}//end finally external../


Enjoy



_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Channels remaining open on Queue Manager
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.