Improve initialisation
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / internal / runtime / CmsDeploymentImpl.java
index f9a1dc36832dab593fb28d53017679f8db5f400c..e1c420b8287469bb698af791d04b9d87638563d9 100644 (file)
@@ -82,7 +82,7 @@ public class CmsDeploymentImpl implements CmsDeployment {
                CmsAuthenticator authenticator = isPublic ? new PublicCmsAuthenticator() : new CmsAuthenticator();
                httpHandlers.put(contextPath, httpHandler);
                httpAuthenticators.put(contextPath, authenticator);
-               if (httpServer == null) {
+               if (httpServer.join() == null) {
                        return;
                } else {
                        createHttpContext(contextPath, httpHandler, authenticator);
@@ -107,16 +107,16 @@ public class CmsDeploymentImpl implements CmsDeployment {
                if (contextPath == null)
                        return; // ignore silently
                httpHandlers.remove(contextPath);
-               if (httpServer == null)
+               if (httpServer.join() == null)
                        return;
                httpServer.join().removeContext(contextPath);
                log.debug(() -> "Removed handler " + contextPath + " : " + httpHandler.getClass().getName());
        }
 
        public boolean allExpectedServicesAvailable() {
-               if (httpExpected && httpServer == null)
+               if (httpExpected && !httpServer.isDone())
                        return false;
-               if (sshdExpected && cmsSshd == null)
+               if (sshdExpected && !cmsSshd.isDone())
                        return false;
                return true;
        }