On 06/17/2013 09:52 AM, Rajesh Khan wrote:
Well the 3 variables that I have are instance variables of a class and are not static variables of a class so they must be thread safe.
If each of the three threads were invoking the method on a separate instance of the class, then there would indeed be no problem (not because it was thread safe but because it was not concurrently invoked).
However in that case adding the lock would have made no difference, so I doubt that is the case?
[...]
Well the code above connects to 3 different queues (i.e each thread connects to a specific queue)
Ok, so you actually want three separate receivers, but you (may) want to share a session and connection between them, is that right?
[...]
Doesnt this mean that these 3 objects (connection,receiver and session) are not thread safe ?
No, its simply a consequence of the preconditions for the methods (i.e. you can only create a session once you have opened the connection and you can only create a receiver on an active session).
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
