private int processPollFds() throws IOException {
  if (pollFds.get(0).revents == POLLIN) {
    byte[] buffer=new byte[8];
    while (IoBridge.read(wakeupIn,buffer,0,1) > 0) {
    }
  }
  int readyKeyCount=0;
  for (int i=1; i < pollFds.size(); ++i) {
    StructPollfd pollFd=pollFds.get(i);
    if (pollFd.revents == 0) {
      continue;
    }
    if (pollFd.fd == null) {
      break;
    }
    SelectionKeyImpl key=(SelectionKeyImpl)pollFd.userData;
    pollFd.fd=null;
    pollFd.userData=null;
    int ops=key.interestOpsNoCheck();
    int selectedOps=0;
    if ((pollFd.revents & POLLHUP) != 0) {
      selectedOps|=ops;
    }
    if ((pollFd.revents & POLLIN) != 0) {
      selectedOps|=ops & (OP_ACCEPT | OP_READ);
    }
    if ((pollFd.revents & POLLOUT) != 0) {
      if (key.isConnected()) {
        selectedOps|=ops & OP_WRITE;
      }
 else {
        selectedOps|=ops & OP_CONNECT;
      }
    }
    if (selectedOps != 0) {
      boolean wasSelected=mutableSelectedKeys.contains(key);
      if (wasSelected && key.readyOps() != selectedOps) {
        key.setReadyOps(key.readyOps() | selectedOps);
        ++readyKeyCount;
      }
 else       if (!wasSelected) {
        key.setReadyOps(selectedOps);
        mutableSelectedKeys.add(key);
        ++readyKeyCount;
      }
    }
  }
  return readyKeyCount;
}

private int processPollFds ( ) throws IOException { if ( pollFds . get ( 0 ) . revents == POLLIN ) { byte [ ] buffer = new byte [ 8 ] ; while ( IoBridge . read ( wakeupIn , buffer , 0 , 1 ) > 0 ) { } } int readyKeyCount = 0 ; for ( int i = 1 ; i < pollFds . size ( ) ; ++ i ) { StructPollfd pollFd = pollFds . get ( i ) ; if ( pollFd . revents == 0 ) { continue ; } if ( pollFd . fd == null ) { break ; } SelectionKeyImpl key = ( SelectionKeyImpl ) pollFd . userData ; pollFd . fd = null ; pollFd . userData = null ; int ops = key . interestOpsNoCheck ( ) ; int selectedOps = 0 ; if ( ( pollFd . revents & POLLHUP ) != 0 ) { selectedOps |= ops ; } if ( ( pollFd . revents & POLLIN ) != 0 ) { selectedOps |= ops & ( OP_ACCEPT | OP_READ ) ; } if ( ( pollFd . revents & POLLOUT ) != 0 ) { if ( key . isConnected ( ) ) { selectedOps |= ops & OP_WRITE ; } else { selectedOps |= ops & OP_CONNECT ; } } if ( selectedOps != 0 ) { boolean wasSelected = mutableSelectedKeys . contains ( key ) ; if ( wasSelected && key . readyOps ( ) != selectedOps ) { key . setReadyOps ( key . readyOps ( ) | selectedOps ) ; ++ readyKeyCount ; } else if ( ! wasSelected ) { key . setReadyOps ( selectedOps ) ; mutableSelectedKeys . add ( key ) ; ++ readyKeyCount ; } } } return readyKeyCount ; }
updates the key ready ops and selected key set .
