code: public static void cleanupThreadLocals(Thread thread)
     {
        if (!OperatingSystemUtils.isJava8())
        {
           return;
        }
        try
        {
           if (thread != null)
           {
              cleanField(thread, Thread.class.getDeclaredField("threadLocals"));
              cleanField(thread, Thread.class.getDeclaredField("inheritableThreadLocals"));
           }
        }
        catch (Exception e)
        {
           log.log(Level.WARNING, "Failed to cleanup ThreadLocal instances for Thread [" + thread + "]", e);
        }
     }
docs: Cleanup {@link ThreadLocal} instances of the given {@link Thread}.
  
  @param thread The {@link Thread} to clean up.