Embedded Jetty why to use join

前端 未结 1 1273
梦如初夏
梦如初夏 2020-12-30 20:03

An example taken from an Embedded Jetty tutorial suggests the following:

public static void main(String[] args) throws Exception
{
   Server server = new Ser         


        
1条回答
  •  無奈伤痛
    2020-12-30 21:00

    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.

    0 讨论(0)
提交回复
热议问题