RE: Session closed suddenly

"Tim Anderson" <[email protected]>
Newsgroups gmane.comp.java.openjms.user
Message-ID <000001c523e8$fafb5f90$0100000a@xerces>
> Jyrki Saarinen wrote:
> 
> > Tim Anderson wrote:
> 
> >There are a couple of possibilities:
> >. someone is invoking close() on the Connection
> >  that owns the Session
> >. the physical connection to the server has been lost.
> >  This forces closure of the Sessions attached to the Connection
> >
> >  You can verify if this is the case by registering
> >  an exception listener with the connection e.g.:
> > 
> >  connection.setExceptionListener(new ExceptionListener() {
> >         public void onException(JMSException exception) {
> >            exception.printStackTrace();
> >         }
> >  };
> >
> Does anyone know whether this pattern of having Session 
> object alive for a long time OK? Or should I create a new 
> Session object every time when I want to publish a message 
> and then close the Session?
> 
> Jyrki
> 

You should be able to have a Session instance for as long as
you have a connection to the server.
You definitely don't need to create a new Session every time
you send a message.
What was the outcome of registering an exception listener?
Did your listener get invoked?

-Tim




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.