Class NioSocketAcceptor.ServerSocketChannelIterator

java.lang.Object
org.apache.mina.transport.socket.nio.NioSocketAcceptor.ServerSocketChannelIterator
All Implemented Interfaces:
Iterator<ServerSocketChannel>
Enclosing class:
NioSocketAcceptor

private static class NioSocketAcceptor.ServerSocketChannelIterator extends Object implements Iterator<ServerSocketChannel>
Defines an iterator for the selected-key Set returned by the selector.selectedKeys(). It replaces the SelectionKey operator.
  • Field Details

  • Constructor Details

    • ServerSocketChannelIterator

      private ServerSocketChannelIterator(Collection<SelectionKey> selectedKeys)
      Build a SocketChannel iterator which will return a SocketChannel instead of a SelectionKey.
      Parameters:
      selectedKeys - The selector selected-key set
  • Method Details

    • hasNext

      public boolean hasNext()
      Tells if there are more SockectChannel left in the iterator
      Specified by:
      hasNext in interface Iterator<ServerSocketChannel>
      Returns:
      true if there is at least one more SockectChannel object to read
    • next

      public ServerSocketChannel next()
      Get the next SocketChannel in the operator we have built from the selected-key et for this selector.
      Specified by:
      next in interface Iterator<ServerSocketChannel>
      Returns:
      The next SocketChannel in the iterator
    • remove

      public void remove()
      Remove the current SocketChannel from the iterator
      Specified by:
      remove in interface Iterator<ServerSocketChannel>