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 .