activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Messages in AMQ are randomly not sent?
Date Mon, 16 Apr 2007 08:09:12 GMT
On 4/16/07, Luciano Mollea <lmollea@yahoo.it> 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/

Mime
View raw message