Multi-Threaded Producer
1 posts in topic
Flat View  Flat View

Posted By:   Joseph_Larson
Posted On:   Monday, March 15, 2004 11:34 AM

I have an application that recently became multi-threaded. Do I need to protect (single-thread) access to MessageProducer.send()?

The only solid documentation I've found regarding thread safety suggests care in using multiple sessions with the same receiver, as onMessage() could be called simultaneously in multiple threads.

Re: Multi-Threaded Producer

Posted By:   Andreas_Mueller  
Posted On:   Monday, March 15, 2004 11:44 PM

You have to ensure that the session is used by a single thread at a time. A message producer object (e.g. QueueSender) is created from the session and depends on it. For example, you cannot use 2 message producers from a single session in 2 different threads. The best is to create a distinct session per thread and create your message producer out of that session and only use it from that thread.
About | Sitemap | Contact