Re: Contexts and Connections, how many are needed

"George H" <[email protected]> Thu, 7 Jun 2007 06:32:49 -0400
Newsgroups gmane.comp.java.openjms.user
Message-ID <[email protected]>
On 6/6/07, Tim Anderson <[email protected]> wrote:
> George H wrote:
> > Hi,
> >
> > If I have a program that has a durable subscriber for 4 topics do I
> > need to have a separate context and connection object per topic for
> > each durable subscriber ?
> >
> > When I first started using openjms I found out that I got many
> > exception when I use a single context and connection to do this. I had
> > to resort to a context/connection object per topic to have a durable
> > subscriber for each. I've have not read anywhere if this was actually
> > needed or if I was just doing something the hard way when there was a
> > simpler way to do it.
> >
> > Does anyone have any tips and/or suggestions on this matter?
> >
> > Thanks in advance.
> >
> >
> No. You can use the one context and connection for all topics. What
> exception were you getting?

I was getting random "NoSuchMethodException"

> One thing you need to watch out for is when you use Sessions. They can
> only be accessed via a single thread at a time.
>
> -Tim
>

Thanks, I am using a single context and connection for everything now.
I'm handling the sessions in separate threads as well.
-- 
"Nothing is impossible for the person that doesn't have to do it"
"The probability of anything happening is in inverse ratio to its desirability"
"If I were a roman statue, I'd be made alabastard"
--
George H
[email protected]

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/