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 Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateServerSocketChannelIterator(Collection<SelectionKey> selectedKeys) Build a SocketChannel iterator which will return a SocketChannel instead of a SelectionKey. -
Method Summary
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining
-
Field Details
-
iterator
The selected-key iterator
-
-
Constructor Details
-
ServerSocketChannelIterator
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:
hasNextin interfaceIterator<ServerSocketChannel>- Returns:
trueif there is at least one more SockectChannel object to read
-
next
Get the next SocketChannel in the operator we have built from the selected-key et for this selector.- Specified by:
nextin interfaceIterator<ServerSocketChannel>- Returns:
- The next SocketChannel in the iterator
-
remove
public void remove()Remove the current SocketChannel from the iterator- Specified by:
removein interfaceIterator<ServerSocketChannel>
-