docs: @Override
      protected void updateSelector() {
          final boolean bTrace = TraceComponent.isAnyTracingEnabled();
          VirtualConnection vci = null;
          NioSocketIOChannel ioSocket = null;
          TCPBaseRequestContext work = null;
  
          final Queue<Object> queue = getWorkQueue();
          if (bTrace && tc.isDebugEnabled()) {
              Tr.debug(this, tc, "updateSelector - processing " + queue.size() + " items");
          }
          while (!queue.isEmpty()) {
              work = (TCPBaseRequestContext) queue.remove();
              ioSocket = (NioSocketIOChannel) work.getTCPConnLink().getSocketIOChannel();
              vci = work.getTCPConnLink().getVirtualConnection();
              // if connection is closed from another thread (like during tcpchannel
              // stop)
              // the vc can become null. if so, ignore this request
              if (vci == null) {
                  if (bTrace && tc.isEventEnabled()) {
                      SocketChannel channel = ioSocket != null ? ioSocket.getChannel() : null;
                      Tr.event(this, tc, "Ignoring due to null vc on " + ((channel != null) ? channel.toString() : "<UNKNOWN>"));
                  }
                  continue;
              }
  
              final int selectorOp;
              if (work.isRequestTypeRead()) {
                  selectorOp = SelectionKey.OP_READ;
              } else {
                  selectorOp = SelectionKey.OP_WRITE;
              }
              // if key is already set, then this channel is already registered
              // so, we can just change the interest ops
              SelectionKey key = getKey(ioSocket.getChannel());
              if (key != null) {
                  if (bTrace && tc.isEventEnabled()) {
                      Tr.event(this, tc, "changing interest ops for channel " + ioSocket.getChannel() + " to " + selectorOp + " for key " + key);
                  }
  
                  if (vci.isInputStateTrackingOperational()) {
                      synchronized (vci.getLockObject()) {
                          // Change it interestOp from none, to the correct operation
                          // Change the request's selection key's interested
                          key.interestOps(selectorOp);
  
                          if (work.isRequestTypeRead()) {
                              if (((TCPReadRequestContextImpl) work).getReadCompletedCallback() != null) {
                                  // only allow closes for outstanding async requests
                                  vci.setReadStatetoCloseAllowedNoSync();
                              }
                          } else {
                              if (((TCPWriteRequestContextImpl) work).getWriteCompletedCallback() != null) {
                                  // only allow closes for outstanding async requests
                                  vci.setWriteStatetoCloseAllowedNoSync();
                              }
                          }
                          if (vci.getCloseWaiting()) {
                              vci.getLockObject().notify();
                          }
                      } // end-vc-sync
                  } else {
                      // Change the request's selection key's interested
                      key.interestOps(selectorOp);
                  }
              } else {
                  if (work.isRequestTypeRead()) {
                      ioSocket.setChannelSelectorRead(this);
                  } else {
                      ioSocket.setChannelSelectorWrite(this);
                  }
  
                  try {
                      if (vci.isInputStateTrackingOperational()) {
                          synchronized (vci.getLockObject()) {
                              SelectionKey selKey = ioSocket.register(selector, selectorOp, work);
                              if (bTrace && tc.isEventEnabled()) {
                                  Tr.event(this, tc, "registered " + ioSocket.getChannel() + ", key is " + selKey);
                              }
                              updateCount();
                              if (work.isRequestTypeRead()) {
                                  if (((TCPReadRequestContextImpl) work).getReadCompletedCallback() != null) {
                                      // only allow closed for outstanding async requests
                                      vci.setReadStatetoCloseAllowedNoSync();
                                  }
                              } else {
                                  if (((TCPWriteRequestContextImpl) work).getWriteCompletedCallback() != null) {
                                      // only allow closed for outstanding async requests
                                      vci.setWriteStatetoCloseAllowedNoSync();
                                  }
                              }
                              if (vci.getCloseWaiting()) {
                                  vci.getLockObject().notify();
                              }
                          } // end-vc-sync
                      } else {
                          SelectionKey selKey = ioSocket.register(selector, selectorOp, work);
                          if (bTrace && tc.isEventEnabled()) {
                              Tr.event(this, tc, "registered " + ioSocket.getChannel() + ", key is " + selKey);
                          }
                          updateCount();
                      }
                  } catch (ClosedChannelException cce) {
  
                      boolean completeOperation = true;
                      if (bTrace && tc.isEventEnabled())
                          Tr.event(this, tc, "SocketChannel register for " + ioSocket + " failed, exception is: " + cce);
  
                      // only check permission for async read/write
                      if (vci.isInputStateTrackingOperational() && !work.blockedThread) {
                          completeOperation = false;
                          if (work.isRequestTypeRead()) {
                              if (vci.requestPermissionToFinishRead()) {
                                  completeOperation = true;
                              }
                          } else {
                              if (vci.requestPermissionToFinishWrite()) {
                                  completeOperation = true;
                              }
                          }
                      }
  
                      if (completeOperation) {
                          if (!wqm.dispatch(work, cce)) {
                              // error could not be dispatched, so put request back on work
                              // queue
                              // and let it fail again later
                              addWork(work);
                          }
                      }
                      continue;
                  }
              }
              if (work.hasTimeout()) {
                  if (work.getTimeoutTime() < nextTimeoutTime) {
                      nextTimeoutTime = work.getTimeoutTime();
                  }
              }
          } // end-while
  
          // if we found any work, reset quit flags
          if (null != work) {
              waitingToQuit = false;
              quit = false;
          }
      }