No, you don't need to because you are using Collections.synchronizedMap. The map it
returns synchronizes on itself in all methods to prevent concurrent access. So
synchronizing on it will prevent other threads mutating it in the middle of the two
calls.
There's some obscure aspect to this I won't go into details here (unless you
want), but for reference, this is discussed in detail in section 5.1.1 of Java Concurrency
in Practice.
You could make toRedeploy a plain HashMap and then put all the calls on it in a
synchronized block. That would have the same effect and would be more understandable.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4211943#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...