docs: IOThread chooseIoThread(long affinity)
      {
          if (ioThreads.isEmpty()) {
              return null;
          }
  
          //  Find the I/O thread with minimum load.
          int minLoad = -1;
          IOThread selectedIoThread = null;
  
          for (int i = 0; i != ioThreads.size(); i++) {
              if (affinity == 0 || (affinity & (1L << i)) > 0) {
                  int load = ioThreads.get(i).getLoad();
                  if (selectedIoThread == null || load < minLoad) {
                      minLoad = load;
                      selectedIoThread = ioThreads.get(i);
                  }
              }
          }
          return selectedIoThread;
      }