commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <>
Subject Re: [messenger] Re: some questions
Date Thu, 24 Apr 2003 13:12:00 GMT

On Thursday, April 24, 2003, at 01:19  pm, Louis Gates wrote:

> Thanks so much for the reply.  I appreciate it.
> If I'm understanding correctly, each thread that uses the same 
> Messenger
> object will have it's own JMS Connection and JMS Session?

No. It will share the same Connection across all threads. Though each 
thread has its own session.

(To be precise, each thread could have 2 sessions - if 1 thread uses 
both the sync & async API then 2 sessions are required as you can't use 
a JMS Session in both sync & async modes).

> If that's the
> case, how do these resources get freed?  I'm assuming calling close on 
> the
> messenger object takes care of it.


> Another question I have is, should I
> close the messenger object after each send?

No. Keeping Session's around is fine, they're pretty lightweight.

> For example, we could
> potentially have hundreds of clients using the same messenger object
> concurrently, which would mean the equivalent number of JMS 
> Connections and
> JMS Sessions.  That just seems like alot of overhead to keep those
> connections and sessions around.  I know some app servers have 
> implemented
> connection and session pooling which would certainly help out this
> situation.  Just wanted to get your thoughts on the messenger with 
> such a
> high load.  Thanks again.

It wouldn't too hard to have a 'closeSession' method to return the 
session to a pool if you're worried of the overhead of Session objects 
lying around. Messenger is an interface, so there can be various 
different implementations.


View raw message