You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Considering that that counters are just for statistics and the low probabibity of a collision I would say that is better to accept a bit of "vagueness" instead of adding a lock.
could be that you are right. Hard to tell without real testing how much "vagueness" this introduces and if using an AtomicInteger would notably degrade performance.
If no AtomicInteger is used I guess at least the members should be made volatile - then at least the visibility problem would be addressed.
Activity
emacarron commentedon Apr 1, 2014
Hi Ronald.
Considering that that counters are just for statistics and the low probabibity of a collision I would say that is better to accept a bit of "vagueness" instead of adding a lock.
ronaldploeger commentedon Apr 1, 2014
Hi Eduardo,
could be that you are right. Hard to tell without real testing how much "vagueness" this introduces and if using an AtomicInteger would notably degrade performance.
If no AtomicInteger is used I guess at least the members should be made volatile - then at least the visibility problem would be addressed.
Best,
Ronald