Browse Source

Merge pull request #12 in DESIGN/design from ~NEIL/design_n:feature/10.0 to feature/10.0

* commit 'ea372294ca583add5d3f2ae4b93e60b2376141fe':
  无JIRA任务,加个锁
master
superman 7 years ago
parent
commit
faf0f1049f
  1. 31
      designer_base/src/com/fr/start/StartServer.java

31
designer_base/src/com/fr/start/StartServer.java

@ -34,6 +34,7 @@ public class StartServer {
// 原先的tomcatHost放在类TomcatHost里面,很不方便操作,而且因为存在多个进程的原因,
// 原先的getInstance()方法无多大意义
private static TomcatHost tomcatHost = null;
private static Object lock = new Object();
static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@ -80,15 +81,17 @@ public class StartServer {
}
private static void initDemoServerAndBrowser() {
if (tomcatHost != null) {
if (!tomcatHost.isDemoAppLoaded()) {
tomcatHost.exit();
synchronized (lock) {
if (tomcatHost != null) {
if (!tomcatHost.isDemoAppLoaded()) {
tomcatHost.exit();
tomcatHost = new TomcatHost(DesignerEnvManager.getEnvManager().getJettyServerPort());
tomcatHost.addAndStartInstallHomeWebApp();
}
} else {
tomcatHost = new TomcatHost(DesignerEnvManager.getEnvManager().getJettyServerPort());
tomcatHost.addAndStartInstallHomeWebApp();
}
} else {
tomcatHost = new TomcatHost(DesignerEnvManager.getEnvManager().getJettyServerPort());
tomcatHost.addAndStartInstallHomeWebApp();
}
try {
if (!tomcatHost.isStarted()) {
@ -105,17 +108,19 @@ public class StartServer {
public static void start() {
try {
if (tomcatHost != null) {
if (NEED_LOAD_ENV) {
tomcatHost.exit();
synchronized (lock) {
if (tomcatHost != null) {
if (NEED_LOAD_ENV) {
tomcatHost.exit();
tomcatHost = new TomcatHost(DesignerEnvManager.getEnvManager().getJettyServerPort());
tomcatHost.addAndStartLocalEnvHomeWebApp();
}
} else {
tomcatHost = new TomcatHost(DesignerEnvManager.getEnvManager().getJettyServerPort());
tomcatHost.addAndStartLocalEnvHomeWebApp();
}
} else {
tomcatHost = new TomcatHost(DesignerEnvManager.getEnvManager().getJettyServerPort());
tomcatHost.addAndStartLocalEnvHomeWebApp();
}
if (!tomcatHost.isStarted()) {
tomcatHost.start();

Loading…
Cancel
Save