public void run(){
  Thread currentThread=Thread.currentThread();
  String oldName=currentThread.getName();
  if (newName != null) {
    setName(currentThread,newName);
  }
  try {
    runnable.run();
  }
  finally {
    setName(currentThread,oldName);
  }
}

public void run ( ) { Thread currentThread = Thread . currentThread ( ) ; String oldName = currentThread . getName ( ) ; if ( newName != null ) { setName ( currentThread , newName ) ; } try { runnable . run ( ) ; } finally { setName ( currentThread , oldName ) ; } }
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 .
