Java’s Collator class (and its subclasses, such as RuleBasedCollator) provides locale-sensitive string comparison, commonly used in sorting and searching operations. However, Collator is not thread-safe, and sharing a single instance across multiple threads can result in significant performance degradation and thread contention, particularly in concurrent environments. This thread-safety limitation is not currently documented in the JDK specification.
Enhancing the API and Java documentation to explicitly state this behavior would help prevent performance issues and operational incidents caused by the incorrect use of Collator in multi-threaded applications.
Enhancing the API and Java documentation to explicitly state this behavior would help prevent performance issues and operational incidents caused by the incorrect use of Collator in multi-threaded applications.
- csr for
-
JDK-8367285 Thread-Safety Usage Warning for java.text.Collator Classes
-
- Draft
-
- links to
-
Review(master) openjdk/jdk/27233