Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { /** * Join the current thread with the specified thread, waiting at most * the given number of milliseconds. A time of zero means wait forever. * A return value of false indicates that some error occured while * waiting or that we were unable to wait because the specified thread * was the current thread. */ public static boolean join(Thread thread, long time) { try { if (thread == Thread.currentThread()) return false; thread.join(time); return true; } catch (Exception ex) { } return false; } }