|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Connectionpooling Problem in Servlet |
« View previous topic :: View next topic » |
Author |
Message
|
mohan098 |
Posted: Sat Jul 09, 2005 2:08 am Post subject: Connectionpooling Problem in Servlet |
|
|
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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|