private int select(long ms) throws IOException {
    if (ms == 0L) {
      return this.nioSelector.selectNow();
    } else if (ms < 0L) {
      return this.nioSelector.select();
    } else {
      return this.nioSelector.select(ms);
    }
  }
Check for data, waiting up to the given timeout.

@param ms Length of time to wait, in milliseconds. If negative, wait indefinitely.
@return The number of keys ready
@throws IOException
ambry-network/src/main/java/com/github/ambry/network/Selector.java