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

ConcurrentHashMap.forEachKey parallelismThreshold description could be clearer

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • None
    • core-libs

      ADDITIONAL SYSTEM INFORMATION :
      Java 17 was used. Yet in current Java 20 the javadoc looks the same.

      A DESCRIPTION OF THE PROBLEM :
      Goal:
      The goal of this bug ticket is to mitigate the risk of falling into the same first pitfall for a lot of other people working the first time with ConcurrentHashMap and spent a lot of time debugging as it is not expected for them.

      Background:
      A few days ago I encountered a bug on our live system because I misread the javadoc of ConcurrentHashMap.forEachKey.
      If I would have read the part about parallelismThreshold in the class javadoc everything would have been clear to me.
      I anticipated that parallelismThreshold is the amount of threads which are used to execute.

      I wish that it's more clear that "parallelismThreshold" had more kind of a "chunk size" / "batch size" naming, which is from my point of view more widely used as a name for this. Yet I guess I understand where the name parallelismThreshold is coming from.
      Or at least a more detailed description in the parameter javadoc and link to the class javadoc.


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: