docs: private Object waitForResult(long timeoutMillis)
                      throws ExecutionException, InterruptedException, TimeoutException, RemoteException { // F16043
          final boolean isTraceOn = svLogger.isLoggable(Level.FINER);
          if (isTraceOn)
              svLogger.entering(CLASS_NAME, "waitForResult", Long.valueOf(timeoutMillis));
  
          long begin = System.nanoTime();
          // The nanoTime updated before every call to
          // RemoteAsyncResultExtended.waitForResult.
          long beginLastAttempt = begin;
          // The nanoTime when we should stop waiting altogether.  This value is
          // only used if timeout is non-zero.
          long end = begin + TimeUnit.MILLISECONDS.toNanos(timeoutMillis);
  
          // True if the client ORB has ever thrown a NO_RESPONSE.
          boolean noResponse = false;
          // The waitTime argument for the next call to
          // RemoteAsyncResultExtended.waitForResult.
          long waitTimeMillis = timeoutMillis;
          // The maximum value for waitTimeMillis.  This value is lazily
          // initialized when a NO_RESPONSE occurs.
          long maxWaitTimeMillis = -1;
  
          for (;;) {
              if (isTraceOn)
                  svLogger.entering(CLASS_NAME, "waitForResult", "waiting " + waitTimeMillis);
  
              Object[] resultArray;
              try {
                  resultArray = stubWaitForResult((Stub) ivServer, waitTimeMillis);
              } catch (RemoteException ex) {
                  Throwable cause = ex.getCause();
  
                  // If this is the first NO_RESPONSE, then try again with a shorter
                  // server-side wait time.  For subsequent NO_RESPONSE, assume there
                  // is a connection issue and rethrow the exception.
                  if (cause instanceof NO_RESPONSE && !noResponse) {
                      if (isTraceOn)
                          svLogger.logp(Level.FINER, CLASS_NAME, "waitForResult", "retrying", cause);
                      resultArray = null;
                      noResponse = true;
                  } else {
                      if (isTraceOn)
                          svLogger.exiting(CLASS_NAME, "waitForResult", ex);
                      throw ex;
                  }
              }
  
              if (resultArray != null) {
                  if (isTraceOn)
                      svLogger.exiting(CLASS_NAME, "waitForResult", "result");
                  return resultArray[0];
              }
  
              // Either the client ORB or the server timed us out.  Choose a lower
              // waitTimeMillis and then try again.
  
              long now = System.nanoTime();
  
              if (timeoutMillis > 0) {
                  long remainingMillis = TimeUnit.NANOSECONDS.toMillis(end - now);
                  if (remainingMillis <= 0) {
                      if (isTraceOn)
                          svLogger.exiting(CLASS_NAME, "waitForResult", "timeout");
                      throw new TimeoutException();
                  }
  
                  waitTimeMillis = remainingMillis;
              }
  
              if (noResponse) {
                  if (maxWaitTimeMillis == -1) {
                      // For the first NO_RESPONSE, set maximum server wait time for
                      // all subsequent requests based on how long the ORB actually
                      // waited before timing out this request.  Back off a little bit
                      // to give time for the server to respond.
                      long actualWaitTimeMillis = TimeUnit.NANOSECONDS.toMillis(now - beginLastAttempt);
                      maxWaitTimeMillis = Math.max(MIN_ASYNC_RESULT_NO_RESPONSE_WAIT_TIME,
                                                   actualWaitTimeMillis - AsyncResultNoResponseBackoff);
                  }
  
                  if (timeoutMillis == 0) {
                      waitTimeMillis = maxWaitTimeMillis;
                  } else {
                      waitTimeMillis = Math.min(waitTimeMillis, maxWaitTimeMillis);
                  }
              }
  
              beginLastAttempt = now;
          }
      }