tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 49778] Inconsistent synchronization in
Date Thu, 19 Aug 2010 23:02:13 GMT

--- Comment #2 from Sebb <> 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_

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:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message