public boolean waitForDestroy(String resourceName) {
		long waitTime = 0;
		boolean exists;
		while ((exists = domainRepository.exists(resourceName)) && waitTime < STATE_CHANGE_TIMEOUT) {
			try {
				Thread.sleep(STATE_CHANGE_WAIT_TIME);
				waitTime += STATE_CHANGE_WAIT_TIME;
			}
			catch (InterruptedException e) {
				Thread.currentThread().interrupt();
			}
		}
		return exists;

	}
Wait for a resource definition to be destroyed.
@param resourceName the name of the resource being destroyed.
@return true if the resource does not exist; false otherwise.
spring-xd-dirt/src/main/java/org/springframework/xd/dirt/test/ResourceStateVerifier.java