Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix startup issue
  • Loading branch information
chenson42 committed Apr 1, 2011
1 parent d464fee commit 3b20b55
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
Expand Up @@ -25,7 +25,9 @@
final public class Constants {

private Constants() {
}
}

public static final String PROP_STANDALONE_WEB = "standalone.web";

public static final String PLEASE_SET_ME = "please set me";

Expand Down
Expand Up @@ -34,6 +34,11 @@ public class DeploymentType {
private boolean professionalRegistered;
private boolean mobileRegistered;
private boolean webServerRegistered;

public DeploymentType() {
webServerRegistered = System.getProperty(Constants.PROP_STANDALONE_WEB, "false").equals("true");
System.getProperties().remove(Constants.PROP_STANDALONE_WEB);
}

public void setEngineRegistered(boolean engineRegistered) {
this.engineRegistered = engineRegistered;
Expand Down
Expand Up @@ -300,6 +300,7 @@ URLConnectingFailure=Could not connect to the %s node's transport because of a b
WebServerInitializeError=Failed to initialize the web server context.
WebServerStarting=About to start SymmetricDS web server on port %d
WebServerSecureStarting=About to start SymmetricDS web server on secure port %d
WebServerAboutToJoin=Joining the web server main thread
XMLSending=Sending XML to IPublisher: %s
Launcher.Option.server=Start an embedded instance of SymmetricDS that accepts HTTP.
Launcher.Option.client=Start an embedded, client-only, instance of SymmetricDS.
Expand Down
Expand Up @@ -62,7 +62,7 @@ public class SymmetricWebServer {

protected static final ILog log = LogFactory.getLog(SymmetricWebServer.class);

protected static final String DEFAULT_WEBAPP_DIR = "../web";
protected static final String DEFAULT_WEBAPP_DIR = "../web";

/**
* The type of HTTP connection to create for this SymmetricDS web server
Expand Down Expand Up @@ -155,7 +155,11 @@ public SymmetricWebServer startMixed(int port, int securePort) throws Exception
return start(port, securePort, Mode.MIXED);
}

public SymmetricWebServer start(int port, int securePort, Mode mode) throws Exception {
public SymmetricWebServer start(int port, int securePort, Mode mode) throws Exception {

// indicate to the app that we are in standalone mode
System.setProperty(Constants.PROP_STANDALONE_WEB, "true");

server = new Server();

server.setConnectors(getConnectors(port, securePort, mode));
Expand All @@ -165,7 +169,6 @@ public SymmetricWebServer start(int port, int securePort, Mode mode) throws Exce
webapp.setContextPath(webHome);
webapp.setWar(webAppDir);
webapp.getSessionHandler().getSessionManager().setMaxInactiveInterval(maxIdleTime/1000);

server.setHandler(webapp);

if (!StringUtils.isBlank(propertiesFile)) {
Expand All @@ -178,14 +181,9 @@ public SymmetricWebServer start(int port, int securePort, Mode mode) throws Exce
int httpJmxPort = port != 0 ? port + 1 : securePort + 1;
registerHttpJmxAdaptor(httpJmxPort);
}

do {
AppUtils.sleep(50);
} while (getEngine() == null);

getEngine().getDeploymentType().setWebServerRegistered(true);

if (join) {

if (join) {
log.info("WebServerAboutToJoin");
server.join();
}

Expand Down

0 comments on commit 3b20b55

Please sign in to comment.