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. 5
      designer_base/src/com/fr/start/StartServer.java

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

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

Loading…
Cancel
Save