116117118119120121122123124
* @return */ public <T> T ensureState(State<T> state) { T res = waitState(state); if(res == null) { throw new TimeoutExpiredException("State '" + state + "' has not been reached in " + waitTime + " milliseconds"); } return res; }
130131132133134135136137138
* @return */ public <T> T ensureValue(T value, State<T> state) { T res = waitValue(value, state); if (res == null) { throw new TimeoutExpiredException("State '" + state + "' has not been reached in " + waitTime + " milliseconds"); } return res; }
107108109110111112113114115
* Throws a TimeoutExpiredException exception if timeout has been expired. * @throws TimeoutExpiredException if timeout has been expired after start() invocation. */ public void check() { if (expired()) { throw (new TimeoutExpiredException(getName() + " timeout expired!")); } }
179180181182183184185186187188189
} if (!completed) { wait(action.getAllowedTime()); if (!completed) { action.interrupt(); throw new TimeoutExpiredException("Action did not finish in " + action.getAllowedTime() + " ms: " + action); } } } catch (InterruptedException ex) { } }