code: public int await(TimeUnit unit, long length) {
          
          int pollPeriodMillis = getPollPeriodMillis();
          long startTime = System.currentTimeMillis();
          long expireTime = startTime + unit.toMillis(length);
  
          int iteration = 0;
          boolean success = false;
          while(true) {
              iteration++;
              try {
                  validate();
                  //no assertion errors? condition passes, we can continue
                  success = true;
                  break;
              } catch (Throwable r) {
                  if ( r instanceof FailImmediatelyException) {
                      throw (FailImmediatelyException)r;
                  } else if ( r.getCause() instanceof FailImmediatelyException) {
                      throw (FailImmediatelyException)r.getCause();
                  }
                  //ignore failures up until the last check
              }
              
              sleepUntil(startTime + (pollPeriodMillis * iteration));
  
              if ( System.currentTimeMillis() >= expireTime) {
                  break;
              }
          }
  
          if ( ! success ) {
              try {
                  validate(); //this time allow any assertion errors to propagate
              } catch (Throwable e) {
                  propagateAsError(e);
              }
          }
          
          return iteration;
      }
docs: Wait for the assertions to pass for the specified time limit
  
  Validation will be attempted and errors handled silently until the timeout period expires after which assertion
  errors will be propagated and will cause test failure
  
  @return number of times validation was retried if it failed the first time