[concurrency-interest] Simple ScheduledFuture problem

David Holmes dcholmes at optusnet.com.au
Wed Aug 30 21:21:33 EDT 2006

Dhanji R. Prasanna writes:
> yes, but presumably a more elegant solution is for the other "setting
> methods" to invoke the single setter, and treat the volatile field as
> a javabeans property.

You don't get atomicity of updates when doing that. Two threads can read the
same value, compute the same incremented value and then use the
single-setter to "atomically" write back the wrong value.


More information about the Concurrency-interest mailing list