Java tutorial
//package com.java2s; public class Main { public static void interruptAndTillDies(final Thread thread) { if (thread != null) { thread.interrupt(); tillDies(thread); } } public static void tillDies(Thread thread) { if (thread != null) { for (;;) { try { thread.join(); break; } catch (InterruptedException ignore) { } } } } }