[CELEBORN-1615] Start the http server after all handlers added

### What changes were proposed in this pull request?

Start the http server after all handlers added.

### Why are the changes needed?
Do not expose the RESTful server before all handlers initialized.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?
Existing UT.

Closes #2764 from turboFei/metrics_not_found.

Authored-by: Wang, Fei <fwang12@ebay.com>
Signed-off-by: Shuang <lvshuang.xjs@alibaba-inc.com>
This commit is contained in:
Wang, Fei 2024-10-09 11:35:49 +08:00 committed by Shuang
parent 8bd5ac0b99
commit 87822f6fe2

View File

@ -209,7 +209,6 @@ abstract class HttpService extends Service with Logging {
httpSslKeyStoreAlgorithm(),
httpSslDisallowedProtocols(),
httpSslIncludedCipherSuites())
httpServer.start()
startInternal()
// block until the HTTP server is started, otherwise, we may get
// the wrong HTTP server port -1
@ -348,9 +347,13 @@ abstract class HttpService extends Service with Logging {
if (metricsSystem.running) {
metricsSystem.getServletContextHandlers.foreach { handler =>
logInfo(s"Adding metrics servlet handler with path ${handler.getContextPath}")
httpServer.addHandler(handler)
}
}
// start the http server after all handlers are added
httpServer.start()
}
override def initialize(): Unit = {