public static void waitThreadTermination ( Thread thread ) { while ( thread != null && thread . isAlive ( ) ) { thread . interrupt ( ) ; try { thread . join ( ) ; } catch ( InterruptedException e ) { } } }
A realiable way to wait for the thread termination