The best method is to "pool" sessions.
Your lockup is probably due to concurrent use of session
objects that is not externally synchronized. See the spec.
When you say "pool" sessions do you mean create a connection to the queue once and never close and use multiple sessions? Let's assume that data keeps flowing into my application. I then need to get the data onto the queue quickly without opening and closing a connection each time.
How do you go about session pooling?
I had a suspicion that I needed to synchronize my calls. I had assumed that JBOSS took care of that.
JBoss takes care of it inside the appserver.
See the jca connectionfactory "java:/JmsXA" defined in
It is supposed to be usable on a client, but I've
never tried it.
In theory, as long as I keep everything synchronized can I have ONE connection that I never close?
My front end is a socket server that connects to a queue. I only need one connection. I do not want a connection going up and down everytime.
Provided you externally synchronize on the session
before sending messages, yes.
This will be less performant than creating one
session for each thread and depending on the
bandwidth/latency you might want to create multiple connections? Think of the connection as a pipe with
multiple inlets (the sessions).
The connection is internally synchronized, the session