Code example for BlockingQueue

Methods: add

0
    UIAScriptRequest res = requestQueue.take();
    return res;
  } 
 
  public void setNextResponse(UIAScriptResponse r) {
    responseQueue.add(r);
  } 
 
  public UIAScriptResponse waitForResponse() throws InterruptedException { 
    UIAScriptResponse res = responseQueue.poll(IOSCapabilities.COMMAND_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
    if (res == null)
      throw new TimeoutException("waiting for UIAScriptResponse");
    return res;
  } 
}