Browse Source

Merge pull request #945 in DESIGN/design from ~JU/design:feature/10.0 to feature/10.0

* commit '8114a3bc642c05d1dc86d83308b56c57c434fb6a':
  REPORT-17988 设计器启动速度&闪退 1、提供并行activator 2、打印启动时长信息用于后面调试
research/10.0
ju 6 years ago
parent
commit
ccc12a3901
  1. 9
      designer-realize/src/main/java/com/fr/start/Designer.java
  2. 7
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

9
designer-realize/src/main/java/com/fr/start/Designer.java

@ -21,6 +21,7 @@ import com.fr.design.gui.ibutton.UIPreviewButton;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.itoolbar.UILargeToolbar; import com.fr.design.gui.itoolbar.UILargeToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.ActiveKeyGenerator; import com.fr.design.mainframe.ActiveKeyGenerator;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.InformationCollector; import com.fr.design.mainframe.InformationCollector;
@ -49,6 +50,7 @@ import com.fr.stable.lifecycle.LifecycleFatalError;
import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLTools;
import com.fr.start.module.StartupArgs; import com.fr.start.module.StartupArgs;
import com.fr.start.server.ServerTray; import com.fr.start.server.ServerTray;
import com.fr.third.org.apache.commons.lang3.time.StopWatch;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -93,6 +95,8 @@ public class Designer extends BaseDesigner {
*/ */
public static void main(String[] args) { public static void main(String[] args) {
StopWatch watch = new StopWatch();
watch.start();
//启动运行时 //启动运行时
FineRuntime.start(); FineRuntime.start();
Module designerRoot = ModuleContext.parseRoot("designer-startup.xml"); Module designerRoot = ModuleContext.parseRoot("designer-startup.xml");
@ -102,7 +106,7 @@ public class Designer extends BaseDesigner {
designerRoot.start(); designerRoot.start();
} catch (LifecycleFatalError fatal) { } catch (LifecycleFatalError fatal) {
SplashContext.getInstance().hide(); SplashContext.getInstance().hide();
JOptionPane.showMessageDialog(null, fatal.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, fatal.getMessage(), Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE);
FineLoggerFactory.getLogger().error(fatal.getMessage(), fatal); FineLoggerFactory.getLogger().error(fatal.getMessage(), fatal);
System.exit(0); System.exit(0);
} }
@ -111,7 +115,8 @@ public class Designer extends BaseDesigner {
//初始化一下serverTray //初始化一下serverTray
ServerTray.init(); ServerTray.init();
} }
FineLoggerFactory.getLogger().info("Designer started.Time used {} ms", watch.getTime());
watch.stop();
} }
/** /**

7
designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

@ -5,6 +5,7 @@ import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.log.FineLoggerFactory;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.record.analyzer.EnableMetrics; import com.fr.record.analyzer.EnableMetrics;
import com.fr.record.analyzer.Metrics; import com.fr.record.analyzer.Metrics;
@ -14,6 +15,7 @@ import com.fr.start.ServerStarter;
import com.fr.start.SplashContext; import com.fr.start.SplashContext;
import com.fr.start.server.FineEmbedServer; import com.fr.start.server.FineEmbedServer;
import com.fr.startup.activators.BasicActivator; import com.fr.startup.activators.BasicActivator;
import com.fr.third.org.apache.commons.lang3.time.StopWatch;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.WorkspaceEvent;
@ -49,14 +51,19 @@ public class DesignerStartup extends Activator {
FineEmbedServer.start(); FineEmbedServer.start();
} }
}); });
final StopWatch watch = new StopWatch();
service.submit(new Runnable() { service.submit(new Runnable() {
@Override @Override
public void run() { public void run() {
try { try {
watch.start();
designer.show(args); designer.show(args);
} finally { } finally {
DesignerContext.getDesignerFrame().getProgressDialog().dispose(); DesignerContext.getDesignerFrame().getProgressDialog().dispose();
FineLoggerFactory.getLogger().info("Designer showed.Time used {} ms", watch.getTime());
watch.stop();
} }
} }
}); });

Loading…
Cancel
Save