Question: Why Was Biased Locking Disabled in Java 15?Answer:Biased locking mainly benefits legacy applications that use data structures such as Vector, Hashtable, or StringBuffer, where each access is synchronized. Modern applications usually use non-synchronized data structures such as ArrayList, HashMap, or StringBuilder – and the data structures optimized for multithreading in the java.util.concurrent package. Because the code for biased locking is highly complex and deeply intertwined with the JVM code, it requires a great deal of maintenance and makes changes within the JVM's synchronization system costly and error-prone. Therefore, the JDK developers decided in JDK Enhancement Proposal 374 to disable biased locking by default, mark it as "deprecated" in Java 15 and remove it entirely in one of the following releases. |
Most helpful rated by users:
- What is Java 15?
- What is Text Blocks or Multi-line string in Java 15?
- What are New String and CharSequence Methods in Java 15?
- What is CharSequence.isEmpty() in Java 15?
- Provide the release notes of Java 15.