Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1254

ThreadLocalRandom should be used in utility classes

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.13.0
    • None
    • None

    Description

      I noticed that both RandomUtils and RandomStringUtils use a constant for the Random instance. The javadoc for Random indicates that ThreadLocalRandom should be used for performance in multithreaded designs. I would think that a public utility class would qualify as a multithreaded design and should therefore use ThreadLocalRandom

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            jmark John Mark
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment