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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P5 P5
    • 22
    • 11, 17, 21
    • 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<>();

            bpb Brian Burkhalter
            aturbanov Andrey Turbanov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: