- this.httpServer.complete(httpServer);
- // create contexts whose handles had already been published
- for (String contextPath : httpHandlers.keySet()) {
- HttpHandler httpHandler = httpHandlers.get(contextPath);
- CmsAuthenticator authenticator = httpAuthenticators.get(contextPath);
- createHttpContext(contextPath, httpHandler, authenticator);
+ if (this.httpServer.isDone())
+ if (httpExpected)
+ throw new IllegalStateException("HTTP server is already set");
+ else
+ return;// ignore
+ // create contexts whose handlers had already been published
+ synchronized (httpHandlers) {
+ synchronized (httpAuthenticators) {
+ this.httpServer.complete(httpServer);
+ for (String contextPath : httpHandlers.keySet()) {
+ HttpHandler httpHandler = httpHandlers.get(contextPath);
+ CmsAuthenticator authenticator = httpAuthenticators.get(contextPath);
+ createHttpContext(contextPath, httpHandler, authenticator);
+ }
+ }