tags:

views:

39

answers:

1

I am seeing a phenomenon where sometimes, connections to the port Jetty is configured on fail with connection refused, shortly after the server starts (after Server.start() returns).

Is there some asynch behaviour involved? Is start() synchronous or not?

+2  A: 

Looking at the docs of the LifeCycle interface, I see there is an isStarted() method as well as an isStarting() method.

The existence of an isStarting() method implies that start() is async. This is just a hunch but it seems reasonable.

[Edit] Actually, you can verify that: Call server.start() then go into a loop that prints the result of server.isStarted() and server.isStarting() (with some sleep period).

Itay