public static void runUnderThreadName(final @NotNull String name, final @NotNull Runnable runnable) {
    Thread currentThread = Thread.currentThread();
    String oldThreadName = currentThread.getName();
    if (name.equals(oldThreadName)) {
      runnable.run();
    }
    else {
      currentThread.setName(name);
      try {
        runnable.run();
      }
      finally {
        currentThread.setName(oldThreadName);
      }
    }
  }
public static void runUnderThreadName(final @NotNull String name, final @NotNull Runnable runnable)