MCPcopy Create free account
hub / github.com/ebarlas/microhttp / doRun

Method doRun

src/main/java/org/microhttp/EventLoop.java:96–110  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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()

Callers 1

runMethod · 0.95

Calls 3

leastConnectionsMethod · 0.95
registerMethod · 0.95
nextMethod · 0.80

Tested by

no test coverage detected