Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: reworded the intro some more

Holding locks while performing time consuming or blocking operations can severely degrade system performance and result in starvation. Furthermore, deadlock may result if too many interdependent threads block. Blocking operations include network I/O, invoking methods such as Console.readLine() and letting a thread defer itself indefinitely.

If the JVM is operating on a platform that uses Java Virtual Machine (JVM) interacts with a file system that operates over the an unreliable network, then file I/O might also suffer the same performance hits as networked I/O. If such a platform is in use, then incur a performance penalty. In such cases, avoid file I/O to files over the network should also be avoided while holding a lock is held.

Noncompliant Code Example (intrinsic lock)

...