Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8367237

Thread-Safety Usage Warning for java.text.Collator Classes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • 26
    • 8u431, 11.0.25, 17.0.13, 21
    • core-libs
    • generic
    • generic

      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.

            jlu Justin Lu
            rkale Raghu Kale
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: