On 18-Nov-08, at 12:18 PM, Mark Miller wrote:

Mike Klaas wrote:


autoCommitCount is written in a CommitTracker.synchronized block only. It is read to print stats in an unsynchronized fashion, which perhaps could be fixed, though I can't see how it could cause a problem

lastAddedTime is only written in a call path within a DirectUpdateHandler2.synchronized block. It is only read in a CommitTracker.synchronized block. It could read the wrong value, but I also don't see this causing a problem (a commit might fail to be scheduled). This could probably also be improved, but doesn't seem important.
Right. I don't see these as causing a deadlock either, but whatever happens, its pretty much JVM undefined right, hence 'who knows' (I'll go with pretty doubtful <g>). I am not so sure its safe to read a value from an unsynced method whether you care about the result or not though. Its prob safe for atomic types and volatiles, but I'm fairly sure your playing with fire doing read/write in and out of sync. I don't think its just about stale values. But then again, it probably works 99.9% of the time or something.

Yeah, something like lastAddedTime is worth getting right, even if it works most of the time. Things like autoCommitCount that read a long unsynchronized only to display on an admin screen don't concern me as much.

-Mike

Reply via email to