private String waitForLoad( String waitingForThisWindowName, String waitingForThisLocalFrame, int timeoutInSeconds) throws RemoteCommandException { for (String matchingFrameAddress = null; timeoutInSeconds >= 0; timeoutInSeconds--) { dataLock.lock(); try { LOGGER.debug( "waiting for window '" + waitingForThisWindowName + "' local frame '" + waitingForThisLocalFrame + "' for " + timeoutInSeconds + " more secs"); matchingFrameAddress = findMatchingFrameAddress( frameAddressToJustLoaded.keySet(), waitingForThisWindowName, waitingForThisLocalFrame); if (null != matchingFrameAddress) { LOGGER.debug( "wait is over: window '" + waitingForThisWindowName + "' was seen at last (" + matchingFrameAddress + ")"); /* * Remove it from the list of matching frame addresses * since it just loaded. Mark whether just loaded * to aid debugging. */ markWhetherJustLoaded(matchingFrameAddress, false); return matchingFrameAddress; } waitUntilSignalOrNumSecondsPassed(resultArrivedOnAnyQueue, 1); } finally { dataLock.unlock(); } } String result = "timed out waiting for window '" + waitingForThisWindowName + "' to appear"; throw new RemoteCommandException(result, result); }