code: public void run() {
          Thread currentThread = Thread.currentThread();
          String oldName = currentThread.getName();
  
          if (newName != null) {
              setName(currentThread, newName);
          }
  
          try {
              runnable.run();
          } finally {
              setName(currentThread, oldName);
          }
      }
docs: Run the runnable after having renamed the current thread's name
  to the new name. When the runnable has completed, set back the
  current thread name back to its origin.