(ch) Re-examine use of sun.nio.ch.Invoker.myGroupAndInvokeCount

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P5
    • 22
    • Affects Version/s: 11, 17, 21
    • Component/s: core-libs
    • 7
    • b20

      Field 'sun.nio.ch.Invoker.myGroupAndInvokeCount' uses anonymous class which overrides 'initialValue' method. But vanilla ThreadLocal.initialValue does the same - just returns 'null'.

          private static final ThreadLocal<GroupAndInvokeCount> myGroupAndInvokeCount =
              new ThreadLocal<GroupAndInvokeCount>() {
                  @Override protected GroupAndInvokeCount initialValue() {
                      return null;
                  }
              };

      It means we can replace it with plain ThreadLocal constructor.

      private static final ThreadLocal<GroupAndInvokeCount> myGroupAndInvokeCount =
                  new ThreadLocal<>();

            Assignee:
            Brian Burkhalter
            Reporter:
            Andrey Turbanov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: