}
}
protected final UIAScriptResponse waitForResponse() {
UIAScriptResponse res = null;
long deadline = System.currentTimeMillis() + COMMAND_TIMEOUT_MILLIS;
while (System.currentTimeMillis() < deadline) {
try {
res = responseQueue.poll(1000, TimeUnit.MILLISECONDS);
} catch (InterruptedException ignore) {
}
// the executor is now stopped. Not need to wait any further
if (!isReady()) {
Response r = new Response();
r.setStatus(13);
r.setSessionId(getSessionId());
if (session.getStopCause() != null) {
r.setValue(session.getStopCause().name());
} else {
r.setValue(UNKNOWN_REASON);
}
UIAScriptResponse response = new UIAScriptResponse(new BeanToJsonConverter().convert(r));
return response;
}
// we have a "valid" response
if (res != null) {