On 4/16/07, Luciano Mollea <[EMAIL PROTECTED]> wrote:
Luciano Mollea wrote: > > Hi all. > We're experiencing a strange situation here. It seems that randomly AMQ > does not send a message, this happens depending on the load, this problem > seems to happen more frequently as more threads concurrently send messages > on the same queue. > > [...] > > [*] a thought about this: the send is not synchronized on the sender > object (that is used multi-threaded) but on the sent message.. could this > be the cause? > I reply myself as it seems we found the solution (and it is as we suspected). The send method of the sender object should be enclosed in a synchronized block like synchronized(sender) { sender.send(message); } Yet, this is something that is not strictly required from the JMS specs (ckeck for example here: http://java.sun.com/javaee/5/docs/api/javax/jms/QueueSender.html):
FWIW the JMS spec states that a Session, MessageProducer, MessageConsumer is only intended to be used by one thread at once (which amounts to the same thing as your workaround - enclosing their use in a synchronized block). -- James ------- http://radio.weblogs.com/0112098/