Browse Source

REPORT-28894 多次切换远程的问题 && xml不可读处理

feature/big-screen
hades 5 years ago
parent
commit
ef9e7cf130
  1. 43
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 8
      designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java
  3. 6
      designer-base/src/main/java/com/fr/exit/DesignerExiter.java

43
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -202,6 +202,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile()); XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile());
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
XmlHandler.Self.handle(e);
} }
// james:如果没有env定义,要设置一个默认的 // james:如果没有env定义,要设置一个默认的
@ -348,23 +349,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} catch (IOException e) { } catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
ErrorDialog dialog = new ErrorDialog(null, XmlHandler.Self.handle(e);
Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"),
Toolkit.i18nText("Fine-Design_Error_Start_Report"),
e.getMessage()) {
@Override
protected void okEvent() {
dispose();
DesignerExiter.getInstance().execute();
}
@Override
protected void restartEvent() {
dispose();
RestartHelper.restart();
}
};
dialog.setVisible(true);
} finally { } finally {
if (null != fileWriter) { if (null != fileWriter) {
try { try {
@ -2059,4 +2044,28 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
public void setVcsConfigManager(VcsConfigManager vcsConfigManager) { public void setVcsConfigManager(VcsConfigManager vcsConfigManager) {
this.vcsConfigManager = vcsConfigManager; this.vcsConfigManager = vcsConfigManager;
} }
enum XmlHandler {
Self;
public void handle(Throwable throwable) {
ErrorDialog dialog = new ErrorDialog(null,
Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"),
Toolkit.i18nText("Fine-Design_Error_Start_Report"),
throwable.getMessage()) {
@Override
protected void okEvent() {
dispose();
DesignerExiter.getInstance().execute();
}
@Override
protected void restartEvent() {
dispose();
RestartHelper.restart();
}
};
dialog.setVisible(true);
DesignerExiter.getInstance().execute();
}
};
} }

8
designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java vendored

@ -8,7 +8,6 @@ import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector;
import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage; import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.module.ModuleContext;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
@ -17,6 +16,7 @@ import com.fr.workspace.connect.WorkspaceClient;
import javax.swing.*; import javax.swing.*;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit;
public class DesignerWorkspaceGenerator { public class DesignerWorkspaceGenerator {
private static final int WAIT_FREQ = 60; private static final int WAIT_FREQ = 60;
private static ExecutorService service = ModuleContext.getExecutor().newSingleThreadExecutor( private static ExecutorService service = Executors.newCachedThreadPool(
new NamedThreadFactory("DesignerWorkspaceGenerator")); new NamedThreadFactory("DesignerWorkspaceGenerator"));
public static Workspace generate(final DesignerWorkspaceInfo config) throws Exception { public static Workspace generate(final DesignerWorkspaceInfo config) throws Exception {
@ -89,4 +89,8 @@ public class DesignerWorkspaceGenerator {
} }
} }
} }
public static void stop() {
service.shutdown();
}
} }

6
designer-base/src/main/java/com/fr/exit/DesignerExiter.java

@ -1,5 +1,6 @@
package com.fr.exit; package com.fr.exit;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.process.engine.core.FineProcessContext; import com.fr.process.engine.core.FineProcessContext;
import com.fr.process.engine.core.FineProcessEngineEvent; import com.fr.process.engine.core.FineProcessEngineEvent;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -19,9 +20,14 @@ public class DesignerExiter {
} }
public void execute() { public void execute() {
beforeExit();
if (FineProcessContext.getParentPipe() != null) { if (FineProcessContext.getParentPipe() != null) {
FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY);
} }
System.exit(0); System.exit(0);
} }
private void beforeExit() {
DesignerWorkspaceGenerator.stop();
}
} }

Loading…
Cancel
Save