guava/src/com/google/common/util/concurrent/Callables.java
@GwtIncompatible // threads
  private static boolean trySetName(final String threadName, Thread currentThread) {
    // In AppEngine, this will always fail. Should we test for that explicitly using
    // MoreExecutors.isAppEngine? More generally, is there a way to see if we have the modifyThread
    // permission without catching an exception?
    try {
      currentThread.setName(threadName);
      return true;
    } catch (SecurityException e) {
      return false;
    }
  }
@GwtIncompatible // threads
  private static boolean trySetName(final String threadName, Thread currentThread) {
    // In AppEngine, this will always fail. Should we test for that explicitly using
    // MoreExecutors.isAppEngine? More generally, is there a way to see if we have the modifyThread
    // permission without catching an exception?
    try {
      currentThread.setName(threadName);
      return true;
    } catch (SecurityException e) {
      return false;
    }
  }
Tries to set name of the given {@link Thread}, returns true if successful.