private void updateCurrentThreadName ( String status ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "DataXceiver for client " ) ; InetAddress ia ; if ( s != null && ( ia = s . getInetAddress ( ) ) != null ) { sb . append ( ia . toString ( ) ) ; } else { sb . append ( "unknown" ) ; } if ( status != null ) { sb . append ( " [" ) . append ( status ) . append ( "]" ) ; } Thread . currentThread ( ) . setName ( sb . toString ( ) ) ; }
Update the thread name to contain the current status . Use this only after this receiver has started on its thread i . e . outside the constructor .