Embedded Jetty why to use join
13,442
join()
is blocking until server is ready. It behaves like Thread.join()
and indeed calls join()
of Jetty's thread pool. Everything works without this because jetty starts very quickly. However if your application is heavy enough the start might take some time. Call of join()
guarantees that after it the server is indeed ready.
Author by
Loner shushman
Updated on June 03, 2022Comments
-
Loner shushman about 2 years
An example taken from an Embedded Jetty tutorial suggests the following:
public static void main(String[] args) throws Exception { Server server = new Server(8080); server.setHandler(new HelloHandler()); server.start(); server.join();}
Why do I need to add the line
server.join()
? It works fine without it.