public static boolean waitFor(File file, int timeout) {
		long stopAt = System.currentTimeMillis() + timeout;

		while (!file.exists() && System.currentTimeMillis() < stopAt) {
			try {
				Thread.sleep(100);
			}
			catch (InterruptedException e) {
				Thread.currentThread().interrupt();
				break;
			}
		}

		return file.exists();
	}
Wait for a file to appear.

@param file the file to look for
@param timeout how long to wait until giving up, in ms
@return true if the file is detected
spring-xd-test-fixtures/src/main/java/org/springframework/xd/test/fixtures/DisposableFileSupport.java