boolean (long timeoutInMilliseconds) { long start = System.currentTimeMillis(); boolean result = super.waitFor(timeoutInMilliseconds); long elapsed = System.currentTimeMillis() - start; try { result &= myWaitFor.waitFor(Math.max(0, timeoutInMilliseconds-elapsed), TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new RuntimeException(e); } return result; }