I am having trouble finding any information about whether an embedded Jetty Server is guaranteed to be fully initialized and ready to receive requests when the call to Server.start() returns.
Nor have I been able to find anything conclusive by debugging.
If the server might still be initializing itself when the call returns, is there any way to register a callback so that I can be notified when it is indeed ready for action?
Yes, when returning from Server.start() the server is ready.
You can register a LifeCycle.Listener using Server.addLifeCycleListener(listener) to get notified of startup or shutdown events. If you look at the source of Server.start() you'll see, that it calls Listener.lifeCycleStarted() at the end.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With