code: private HTTPExchange nextExchange(int idx) {
          assertUnlocked();
  
          final Thread thread = Thread.currentThread();
          HTTPExchange exch = null;
          lock.lock();
          try {
              do {
                  if (procThreads == null
                          || !thread.equals(procThreads[idx].procThread)) {
                      break;
                  }
                  exch = claimExchange(idx);
                  if (exch == null) {
                      try {
                          notEmpty.await();
                      } catch (InterruptedException intx) {
                          LOG.log(Level.FINEST, INTERRUPTED, intx);
                      }
                  }
              } while (exch == null);
          } finally {
              lock.unlock();
          }
          return exch;
      }
docs: Get the next message exchange to process, blocking until one becomes
  available if nothing is already waiting for processing.
  
  @param idx the {@link #procThreads} index of the "RequestProcessor"
  for which this method is executed.
  
  @return next available exchange to process, or {@code null} if no
  exchanges are immediately available