/** * Wait for an external condition * @param condition The external condition. */ public void waitForExternalCondition(IExternalCondition condition) { waitForExternalCondition(condition, -1); }
/** * Wait for the result. * @param timeout The timeout. * @return The result. * @throws TimeoutException when result is not available in specified time frame. */ public Object waitForResult(long timeout) { if(!getInterpreter().isPlanThread()) throw new RuntimeException("SyncResultListener may only be used from plan thread."); if(!alreadyresumed) { this.alreadysuspended = true; waitForExternalCondition(this, timeout); } Exception ex = exception; Object res = result; reset(); // if(ex instanceof RuntimeException) // throw (RuntimeException)ex; if(ex!=null) throw new RuntimeException(ex); return res; }
waitForExternalCondition(lis, timeout); // Don't use waitForResult(), because of exception being thrown.