code: public static void waitWhileState(final DeviceProxy proxy, final DevState waitState, final long timeout,
  	    final long pollingTime) throws DevFailed, TimeoutException {
  	final long time0 = System.currentTimeMillis();
  
  	while (proxy.state().equals(waitState)) {
  	    if (System.currentTimeMillis() - time0 > timeout) {
  		throw new TimeoutException(
  			"Stateutilities.waitWhileState : timeout reached while waiting end of state "
  				+ TangoConst.Tango_DevStateName[waitState.value()]);
  	    }
  	    try {
  		Thread.sleep(pollingTime);
  	    } catch (final InterruptedException e) {
  		// ignore
  	    }
  	}
  
      }
docs: Wait while waitState does not change
  
  @param proxy
  the proxy on which to monitor the state
  @param waitState
  the state to wait
  @param timeout
  a timeout in ms
  @param pollingTime
  the polling period in ms
  @throws DevFailed
  @throws TimeoutException