private void waitForStateChange(int maxTTW) throws MqttException {
synchronized (waiter) {
    if (!donext) {
      try {
        waiter.wait(maxTTW);
      }
 catch (      InterruptedException e) {
        log("timed out");
        e.printStackTrace();
      }
      if (ex != null) {
        throw (MqttException)ex;
      }
    }
    donext=false;
  }
}

private void waitForStateChange ( int maxTTW ) throws MqttException { synchronized ( waiter ) { if ( ! donext ) { try { waiter . wait ( maxTTW ) ; } catch ( InterruptedException e ) { log ( "timed out" ) ; e . printStackTrace ( ) ; } if ( ex != null ) { throw ( MqttException ) ex ; } } donext = false ; } }
wait for a maximum amount of time for a state change event to occur
