< prev index next >

src/java.base/share/classes/jdk/internal/misc/TerminatingThreadLocal.java

Print this page
*** 77,20 ***
       * Register given TerminatingThreadLocal
       *
       * @param tl the ThreadLocal to register
       */
      public static void register(TerminatingThreadLocal<?> tl) {
!         REGISTRY.get().add(tl);
      }
  
      /**
       * Unregister given TerminatingThreadLocal
       *
       * @param tl the ThreadLocal to unregister
       */
      private static void unregister(TerminatingThreadLocal<?> tl) {
!         REGISTRY.get().remove(tl);
      }
  
      /**
       * a per-thread registry of TerminatingThreadLocal(s) that have been registered
       * but later not unregistered in a particular thread.
--- 77,22 ---
       * Register given TerminatingThreadLocal
       *
       * @param tl the ThreadLocal to register
       */
      public static void register(TerminatingThreadLocal<?> tl) {
!         if (!Thread.currentThread().isVirtual())
+             REGISTRY.get().add(tl);
      }
  
      /**
       * Unregister given TerminatingThreadLocal
       *
       * @param tl the ThreadLocal to unregister
       */
      private static void unregister(TerminatingThreadLocal<?> tl) {
!         if (!Thread.currentThread().isVirtual())
+             REGISTRY.get().remove(tl);
      }
  
      /**
       * a per-thread registry of TerminatingThreadLocal(s) that have been registered
       * but later not unregistered in a particular thread.
< prev index next >