Sanne/JGroups — comment on commit b2c4ad53aa9f76e7018a45a4626c66c52e7ee349
File:  line 0
By belaban:

What's the point of making size (e.g.) volatile ? Add and remove change size all the time; this means a memory fence is inserted into each method, which is already protected by a lock (NRW.lock). As was discussed on the code, in the best case the volatile inside of a lock is optimized away by the JIT, in the worst case, we have an additional mfence/LoadAndStore or whatever instruction, which could slow things down.
IMO, volatiles should only be used in cases where we have many reads and only a few writes, which is not the case above !
Did you run perf tests on this change to prove me wrong ?