The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

murraytodd (4) [Avatar] Offline
#1
At the end of the "Thread-Safety Revisited" section (bottom of page 17smilie I'm confused about the final version of the Counter class--specifically that the count variable is NOT marked as volatile.

In the paragraph before you write "Can we now call Counter thread-safe? It has proper visibility across threads, and it works in singletons that guarded it appropriately." From this I would infer that in the final version we would have count defined as volatile while leaving the annotation as @NotThreadSafe.

Is this an error, or am I not understanding this final recommended form?