flink-instrumentation/workspace/flink-1.4.1-instrumented/flink-1.4.1/flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/ExecutionGraphTestUtils.java
/**
	 * Waits until the Execution has reached a certain state.
	 *
	 * <p>This method is based on polling and might miss very fast state transitions!
	 */
Waits until the Execution has reached a certain state.
This method is based on polling and might miss very fast state transitions!
Waits until the Execution has reached a certain state . This method is based on polling and might miss very fast state transitions!
public static void waitUntilExecutionState(Execution execution, ExecutionState state, long maxWaitMillis)
			throws TimeoutException {
		checkNotNull(execution);
		checkNotNull(state);
		checkArgument(maxWaitMillis >= 0);
		final long deadline = maxWaitMillis == 0 ? Long.MAX_VALUE : System.nanoTime() + (maxWaitMillis * 1_000_000);
		while (execution.getState() != state && System.nanoTime() < deadline) {
			try {
				Thread.sleep(2);
			} catch (InterruptedException ignored) {}
		}
		if (System.nanoTime() >= deadline) {
			throw new TimeoutException();
		}
	}
public static void waitUntilExecutionState ( Execution execution , ExecutionState state , long maxWaitMillis ) throws TimeoutException { checkNotNull ( execution ) ; checkNotNull ( state ) ; checkArgument ( maxWaitMillis >= 0 ) ; final long deadline = maxWaitMillis == 0 ? Long . MAX_VALUE : System . nanoTime ( ) + ( maxWaitMillis * 1_000_000 ) ; while ( execution . getState ( ) != state && System . nanoTime ( ) < deadline ) { try { Thread . sleep ( 2 ) ; } catch ( InterruptedException ignored ) { } } if ( System . nanoTime ( ) >= deadline ) { throw new TimeoutException ( ) ; } }
Waits until the Execution has reached a certain state.
Waits until the Execution has reached a certain state .
// this is a poor implementation - we may want to improve it eventually