Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-2928 YARN Timeline Service v.2: alpha 1
  3. YARN-5170

Eliminate singleton converters and static method access

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      As part of YARN-5109 we introduced several KeyConverter classes.
      To stay consistent with the existing LongConverter in the sample patch I created I made these other converter classes singleton as well.

      In conversation with sjlee0 who has a general dislike of singletons, we discussed it is best to get rid of these singletons and make them simply instance variables.

      There are other classes where the keys have static methods referring to a singleton converter.
      Moreover, it turns out that due to code evolution we end up creating the same keys several times.
      So general approach is to not re-instantiate rowkeys, converters when not needed.
      I would like to create the byte[] rowKey in the RowKey classes their constructor, but that would leak an incomplete object to the converter.

      There are a few method in TimelineStorageUtils that are used only once, or only by one class, as part of this refactor I'll move these to keep the "Utils" class as small as possible and keep them for truly generally used utils that don't really belong anywhere else.

      Attachments

        1. YARN-5170-YARN-2928.01.patch
          123 kB
          Joep Rottinghuis
        2. YARN-5170-YARN-2928.02.patch
          143 kB
          Joep Rottinghuis
        3. YARN-5170-YARN-2928.03.patch
          170 kB
          Joep Rottinghuis
        4. YARN-5170-YARN-2928.04.patch
          175 kB
          Joep Rottinghuis
        5. YARN-5170-YARN-2928.05.patch
          187 kB
          Joep Rottinghuis
        6. YARN-5170-YARN-2928.06.patch
          191 kB
          Joep Rottinghuis
        7. YARN-5170-YARN-2928.07.patch
          193 kB
          Joep Rottinghuis
        8. YARN-5170-YARN-2928.08.patch
          193 kB
          Joep Rottinghuis
        9. YARN-5170-YARN-2928.09.patch
          193 kB
          Joep Rottinghuis
        10. YARN-5170-YARN-2928.10.patch
          211 kB
          Joep Rottinghuis
        11. YARN-5170-YARN-2928.11.patch
          254 kB
          Joep Rottinghuis
        12. YARN-5170-YARN-2928.12.patch
          254 kB
          Joep Rottinghuis
        13. YARN-5170-YARN-2928.13.patch
          253 kB
          Varun Saxena

        Issue Links

          Activity

            People

              jrottinghuis Joep Rottinghuis
              jrottinghuis Joep Rottinghuis
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: