¡@

Home 

java Programming Glossary: statusmessage

Why is it not good practice to synchronize on Boolean?

http://stackoverflow.com/questions/10324272/why-is-it-not-good-practice-to-synchronize-on-boolean

Sample Code private Boolean isOn false private String statusMessage I'm off public void doSomeStuffAndToggleTheThing Do some stuff.. Do some stuff synchronized isOn if isOn isOn false statusMessage I'm off Do everything else to turn the thing off else isOn true.. Do everything else to turn the thing off else isOn true statusMessage I'm on Do everything else to turn the thing on java multithreading..