dcsimg
When to close connection
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Bryan_Hanson
Posted On:   Tuesday, February 25, 2003 10:29 AM

This is how I send the xml: QueueSender qs = new QueueSender(Qmanager,Queue,HostName); qs.send(xml_string,""); qs.close(); The QueueSender class has the following private variables which hold references to MQ. private javax.jms.QueueSession session; private javax.jms.QueueConnection connection = null; private javax.jms.QueueSender sender = null; private javax.jms.Queue sendQueue = null; Question: 1) Should I be calling qs.close() after each message (This sets the connection and session = null). Is creating a new connection an intensive task to be avoided, or does MQ have some black box connectivity where creating a new connection for every messag   More>>


This is how I send the xml:
QueueSender qs = new QueueSender(Qmanager,Queue,HostName);
qs.send(xml_string,"");
qs.close();


The QueueSender class has the following private variables which hold references to MQ.

private javax.jms.QueueSession session;
private javax.jms.QueueConnection connection = null;
private javax.jms.QueueSender sender = null;
private javax.jms.Queue sendQueue = null;

Question:
1)
Should I be calling qs.close() after each message (This sets the connection and session = null). Is creating a new connection an intensive task to be avoided, or does MQ have some black box connectivity where creating a new connection for every message is only a impact the firt time.

2)
Would it make more sense to have QueueSender static at a class level in the concrete class using it, the somehow close it when the JVM unloads the concrete class?

Thanks in advance for any feedback.    <<Less
About | Sitemap | Contact