[rabbitmq-discuss] questions about RpcClient

Matthias Radestock matthias at rabbitmq.com
Mon Nov 21 09:24:48 GMT 2011

On 21/11/11 09:11, john doe wrote:
> Thank you Matthias.
> If this class is known to *not* be threadsafe, why is there a
> "synchronized" statement in primitiveCall? It somewhat confuses me.

That synchronisation is necessary for the coordination of the thread 
issuing a call with the thread on which the reply arrives.

The code calls _channel.basicPublish, which is not threadsafe, outside 
of any synchronisation context. Hence it is not safe to issue calls from 
multiple threads or use the underlying channel in other threads.


More information about the rabbitmq-discuss mailing list