Cliff Straw wrote:
> 
> I have a multi-threaded server application that uses a JavaBean to service a
> client request. The bean is responsible for publishing a message to a JMS
> topic. I am considering two implementations. One implementation uses
> synchronization to share a topic session among all threads. The other
> implementation creates a separate topic session for each thread.
> 
> My question is, which option is more efficient. Are the topic session, topic
> connection and message objects lightweight enough to create a new one for
> each request that is being processed? Or am I better off sharing these
> objects and having the threads potentially wait to enter the synchronization
> block?

A more efficient method is to use a single session/publisher. To create
a session/publisher for each request is too much overhead on the router
side. Just benchmark it. Another option is to pool sessions/publishers
and to use them round-robin. But then you should also use more than 1
connection to avoid a bottleneck. 

-- 
Andreas Mueller, [EMAIL PROTECTED], IIT GmbH, Bremen/Germany, http://www.iit.de
SwiftMQ - JMS Enterprise Messaging System, http://www.swiftmq.com
-----------------------------------------------------------------------
Support SwiftMQ! PLEASE vote for SwiftMQ as "Best Java Messaging Tool":
          http://www.sys-con.com/java/readerschoice2001/
-----------------------------------------------------------------------

------------------------------------------------------
SwiftMQ developers mailing list * http://www.swiftmq.com
To unsubscribe from this list, send an eMail to 
[EMAIL PROTECTED] and write in the body of your message:
UNSUBSCRIBE developers <your-email-address>
Archive: http://www.mail-archive.com/developers@mail.iit.de/




Reply via email to