Java tutorial
//package com.java2s; // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt public class Main { /** * * "waitTimeBool" wait for the given time. * * @param object wait() will be start on this given object * @param time * @return true if interrupted, else false */ public static boolean waitTimeBool(Object object, long time) { synchronized (object) { try { object.wait(time); } catch (InterruptedException e) { return true; } } return false; } /** * * "waitTimeBool" wait for the given time. * * @param time * @return true if interrupted, else false */ public static boolean waitTimeBool(long time) { synchronized (Thread.currentThread()) { try { Thread.currentThread().wait(time); } catch (InterruptedException e) { return true; } } return false; } }