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 » Connectionpooling Problem in Servlet

Post new topic  Reply to topic
 Connectionpooling Problem in Servlet « View previous topic :: View next topic » 
Author Message
mohan098
PostPosted: Sat Jul 09, 2005 2:08 am    Post subject: Connectionpooling Problem in Servlet Reply with quote

Newbie

Joined: 09 Jul 2005
Posts: 1

Hi,
I am new to MQSeries. I have written a java servlet program to connect to queuemanager.
when multiple users access servlet simultaneously, the page is just
hanging or waiting?. I dont know.
I thought might be because of connectionpooling problem
So I used MQSimpleConnectionManager for connectionpooling.

But I have doubts in the way I have written the code and I am not
able to find java manuals for this.
So Plese help me,

My doubts are

1. Whether connection pool logic and instantiating qmanager object can be written in Init() method of the servlet?

I have written code like below.
code snippets:

public void init {
try {
//Create a connection pool to the queue manager
cmgr = new MQSimpleConnectionManager();
cmgr.setActive(MQSimpleConnectionManager.MODE_AUTO);
cmgr.setTimeout(300000);
cmgr.setHighThreshold(100);
MQEnvironment.setDefaultConnectionManager(cmgr);

//Register a token
token=MQEnvironment.addConnectionPoolToken();

//Create a connection to the queue manager
qMgr = new MQQueueManager(q_managername);

}
catch (MQException ex)
{
out.println("An MQ error occourred in init(): Completion code " + ex.completionCode + " Reason code" + ex.reasonCode);

try {
//Disconnect from the queue manager
if (qMgr != null)
qMgr.disconnect();
MQEnvironment.removeConnectionPoolToken(token);
}
catch (MQException e1){
out.println("Exception");
}
}
}

2. Where MQEnvironment.removeConnectionPoolToken(token) method have to be written?,
after qMgr.disconnect() method or in destroy method of the servlet?

3. I am Using bind connection. If the connection is bind, then
MQEnvironment.setDefaultConnectionManager(cmgr) will work?
Usually MQEnvironment properties will be set to null for bind connection.

4. For each user servlet instance, will connection pooling (i.e.MQEnvironment.addConnectionPoolToken) be created ?.

5. If MQEnvironment.removeConnectionPoolToken(token) is being executed for one servlet instance, whether
other user servlet instances also will be affected? because this method will remove all connections to the qmanager in the pool, that is why.

6. Is it ok, opening queue at one time and put more than one messages and close the queue.

Your help will be appreciated.

Thanks
_________________
Regards
Mohan
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 » Connectionpooling Problem in Servlet
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.