Undertow を使用して単純なアプリケーションを作成しています。
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();
}
}
でブラウザーのタブlocalhost:8080
を開き、2 つ目のタブも開きますlocalhost:8080
今回は、最初のタブが 5 秒間待機し、2 番目のタブが 10 秒間待機します。
なぜそうなのですか?