https://issues.apache.org/bugzilla/show_bug.cgi?id=49778
--- Comment #2 from Sebb <s...@apache.org> 2010-08-19 19:02:10 EDT --- (In reply to comment #1) > Such a change is utterly useless. Not true. The synchronisation block ensures that the value read by the thread is the current value. > Since the lock is dropped immediately after > retrieving the value, the value may change well before any decisions can be > made based on the value. This is completely independent of the JVM memory > model. True, but irrelevant here. > If you want to insure that getCount always retrieves the current value, the > field must be flagged as volatile Not strictly true. Volatile is _one_ way to ensure safe publication, but it is not the _only_ solution. Since the other accesses need to use synchronisation, it makes sense to use synchronisation here too. > - but that does nothing to prevent it > changing the moment after it has been referenced. Again true, but irrelevant. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org