I am using Undertow to create a simple application.
public class App {
public static void main(String[] args) {
Undertow server = Undertow.builder().addListener(8080, "localhost")
.setHandler(new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
Thread.sleep(5000);
exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");
exchange.getResponseSender().send("Hello World");
}
}).build();
server.start();
}
}
I open a browser tab on localhost:8080
and I open a second
tab also on localhost:8080
This time the first tab will wait 5 seconds, and the second will wait 10 seconds
Why is it so?