Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-15802

ConnectionUtils should use ThreadLocalRandom instead of Random

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 1.4.0, 2.0.0
    • None
    • None
    • Reviewed

    Description

      public final class ConnectionUtils {
      ...skip...
        private static final Random RANDOM = new Random();
      

      In general, static fields are accessed by multi-threads. The class Random is thread-safe but ThreadLocalRandom is more preferable because of less contention.

      Attachments

        1. hbase-15802.patch
          3 kB
          Matt Warhaftig

        Activity

          People

            mwarhaftig Matt Warhaftig
            ikeda Hiroshi Ikeda
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: