private void quietlyJoinThread(final Thread thread) { if (thread != null) { try { // interrupt the thread in case it is stuck waiting for output that will never come thread.interrupt(); thread.join(); } catch (InterruptedException ignored) { Thread.currentThread().interrupt(); } } }