Multithreading in Java
  • In JDK4 and before, "volatile" did not have the proper semantics to allow the double-checked locking idiom to work. As of JDK5, it does.
    • It's about how the JIT can re-order read and write operations of nonvolatile field accesses around volatile fields.
  • In JDK5+, the idea is that the compiler ensures that whatever thread A can see when writing to a volatile field, thread B will have access when reading from the same field.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License