()
| 94 | } |
| 95 | |
| 96 | private void doRun() throws IOException { |
| 97 | while (!stop.get()) { |
| 98 | selector.select(options.resolution().toMillis()); |
| 99 | Set<SelectionKey> selectedKeys = selector.selectedKeys(); |
| 100 | Iterator<SelectionKey> it = selectedKeys.iterator(); |
| 101 | while (it.hasNext()) { |
| 102 | SelectionKey selKey = it.next(); |
| 103 | if (selKey.isAcceptable()) { |
| 104 | ConnectionEventLoop connectionEventLoop = leastConnections(); |
| 105 | connectionEventLoop.register(serverSocketChannel.accept()); |
| 106 | } |
| 107 | it.remove(); |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | private ConnectionEventLoop leastConnections() { |
| 113 | return connectionEventLoops.stream() |
no test coverage detected