Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Immutable objects are inherently thread-safe; they may be passed shared between multiple threads or published without synchronization.

...

Wiki Markup
*synchronization* : "The Java programming language provides multiple mechanisms for communicating between threads. The most basic of these methods is _synchronization_, which is implemented using monitors. Each object in Java is associated with a monitor, which a thread can lock or unlock. Only one thread at a time may hold a lock on a monitor. Any other threads attempting to lock that monitor are blocked until they can obtain a lock on that monitor." \[[JLS 05|AA. Java References#JLS 05]\].

Anchor
thread-safe
thread-safe

thread-safe : An object is thread-safe, if it can be shared by multiple threads without the possibility of any data races. Immutable classes are thread safe by definition. Mutable classes may also be thread-safe if they are properly synchronized.

Anchor
trusted code
trusted code

...