Browse Source

Pull request #15080: REPORT-137327 - 远程设计下切换目录卡顿优化

Merge in DESIGN/design from ~DESTINY.LIN/design:fbp/release to fbp/release

* commit '3b7def91a0b5c8be1fb85948f0b5e1284524fb2c':
  REPORT-137327 - 远程设计下切换目录卡顿优化 自动启动
  REPORT-137327 - 远程设计下切换目录卡顿优化 修改缓存机制
  REPORT-137327 - 远程设计下切换目录卡顿优化
  REPORT-137327 - 远程设计下切换目录卡顿优化
fbp/release
Destiny.Lin-林锦龙 1 month ago
parent
commit
c0a4e211f4
  1. 62
      designer-base/src/main/java/com/fr/design/cache/DesignCacheManager.java
  2. 9
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  3. 1
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  4. 9
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  5. 1
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  6. 5
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  7. 3
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  8. 1
      designer-realize/src/main/java/com/fanruan/boot/env/DesignFunctionComponent.java
  9. 34
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java
  10. 5
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java
  11. 3
      designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java
  12. 13
      designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java
  13. 3
      designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewWorkBookAction.java

62
designer-base/src/main/java/com/fr/design/cache/DesignCacheManager.java vendored

@ -1,62 +0,0 @@
package com.fr.design.cache;
import com.fr.base.TableData;
import com.fr.design.data.tabledata.wrapper.TableDataFactory;
import java.util.Map;
/**
* 设计器缓存管理
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/8/11
*/
public class DesignCacheManager {
public static ThreadLocal<Map<String, TableData>> cacheTableData = new ThreadLocal<>();
/**
* 处理任务使用数据集缓存
*/
public static void processByCacheTableData(Task task) {
try {
cacheTableData.set(TableDataFactory.getTableDatas());
task.process();
} finally {
cacheTableData.remove();
}
}
/**
* 是否使用数据集的缓存
*/
public static boolean useDataCache() {
return cacheTableData.get() != null;
}
/**
* 获取数据集缓存
*/
public static ThreadLocal<Map<String, TableData>> getCacheTableData() {
return cacheTableData;
}
/**
* 设置数据集缓存
*/
public static void setCacheTableData(ThreadLocal<Map<String, TableData>> cacheTableData) {
DesignCacheManager.cacheTableData = cacheTableData;
}
/**
* 任务
*/
public interface Task {
/**
* 处理
*/
void process();
}
}

9
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -19,7 +19,6 @@ import com.fr.data.impl.storeproc.StoreProcedureConstants;
import com.fr.data.impl.storeproc.StoreProcedureHelper; import com.fr.data.impl.storeproc.StoreProcedureHelper;
import com.fr.data.operator.DataOperator; import com.fr.data.operator.DataOperator;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.cache.DesignCacheManager;
import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.data.tabledata.wrapper.MultiResultTableDataNameWrapper; import com.fr.design.data.tabledata.wrapper.MultiResultTableDataNameWrapper;
import com.fr.design.data.tabledata.wrapper.MultiResultTableDataWrapper; import com.fr.design.data.tabledata.wrapper.MultiResultTableDataWrapper;
@ -449,13 +448,7 @@ public abstract class DesignTableDataManager {
} }
private static void addServerData(java.util.Map<String, TableDataWrapper> resMap) { private static void addServerData(java.util.Map<String, TableDataWrapper> resMap) {
Map<String, TableData> tableDataMap; Map<String, TableData> tableDataMap = TableDataFactory.getTableDatas();
if (DesignCacheManager.useDataCache()) {
FineLoggerFactory.getLogger().debug("use cache Table data wrapper.");
tableDataMap = DesignCacheManager.getCacheTableData().get();
} else {
tableDataMap = TableDataFactory.getTableDatas();
}
for (Entry<String, TableData> entry : tableDataMap.entrySet()) { for (Entry<String, TableData> entry : tableDataMap.entrySet()) {
if (globalDsCache.containsKey(entry.getKey())) { if (globalDsCache.containsKey(entry.getKey())) {
resMap.put(entry.getKey(), globalDsCache.get(entry.getKey())); resMap.put(entry.getKey(), globalDsCache.get(entry.getKey()));

1
designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java

@ -336,6 +336,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
for (ServerDataSetBean bean : deleteDatas) { for (ServerDataSetBean bean : deleteDatas) {
TableDataRepository.getInstance().delete(bean); TableDataRepository.getInstance().delete(bean);
} }
TableDataRepository.getInstance().invalidCache();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }

9
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -12,7 +12,6 @@ import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.cache.DesignCacheManager;
import com.fr.design.data.BasicTableDataTreePane; import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.data.BasicTableDataUtils; import com.fr.design.data.BasicTableDataUtils;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
@ -461,7 +460,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
if (!ComparatorUtils.equals(oldName, tdName)) { if (!ComparatorUtils.equals(oldName, tdName)) {
map.put(oldName, tdName); map.put(oldName, tdName);
} }
DesignCacheManager.processByCacheTableData(() -> fireDSChanged(map)); fireDSChanged(map);
tc.fireTargetModified(); tc.fireTargetModified();
tc.parameterChanged(); tc.parameterChanged();
int[] rows = tableDataTree.getSelectionRows(); int[] rows = tableDataTree.getSelectionRows();
@ -1023,7 +1022,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
DesignCacheManager.processByCacheTableData(() -> dgEdit(getTableDataInstance().creatTableDataPane(), createDsName(getNamePrefix()), false)); dgEdit(getTableDataInstance().creatTableDataPane(), createDsName(getNamePrefix()), false);
} }
} }
@ -1129,7 +1128,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
BasicDialog basicDialog = basicPane.showSmallWindow(SwingUtilities.getWindowAncestor(TableDataTreePane.this), new DialogActionAdapter() { BasicDialog basicDialog = basicPane.showSmallWindow(SwingUtilities.getWindowAncestor(TableDataTreePane.this), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
DesignCacheManager.processByCacheTableData(this::processRemove); processRemove();
} }
private void processRemove() { private void processRemove() {
@ -1203,7 +1202,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
DesignCacheManager.processByCacheTableData(this::doPaste); doPaste();
} }
private void doPaste() { private void doPaste() {

1
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -360,6 +360,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
EventDispatcher.fire(RemoteConfigEvent.EDIT, "ConnectionConfig"); EventDispatcher.fire(RemoteConfigEvent.EDIT, "ConnectionConfig");
} }
ConnectionRepository.getInstance().invalidCache();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
throw e; throw e;

5
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java

@ -13,7 +13,6 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.file.LocateAction; import com.fr.design.actions.file.LocateAction;
import com.fr.design.actions.template.NewWorkBookToolButtonAction; import com.fr.design.actions.template.NewWorkBookToolButtonAction;
import com.fr.design.cache.DesignCacheManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
@ -837,13 +836,13 @@ public class MultiTemplateTabPane extends Row {
setIsCloseCurrent(true); setIsCloseCurrent(true);
} }
closeFormat(template); closeFormat(template);
DesignCacheManager.processByCacheTableData(() -> closeSpecifiedTemplate(template)); closeSpecifiedTemplate(template);
DesignerContext.getDesignerFrame().getContentFrame().repaint(); DesignerContext.getDesignerFrame().getContentFrame().repaint();
isShowList = false; isShowList = false;
} else { } else {
//没有点击关闭和ListDown按钮,则切换到点击的模板处 //没有点击关闭和ListDown按钮,则切换到点击的模板处
closeIconIndex = -1; closeIconIndex = -1;
DesignCacheManager.processByCacheTableData(() -> switchJTemplate(getTemplateIndex(evtX))); switchJTemplate(getTemplateIndex(evtX));
clodeIcon = new LazyIcon("clear"); clodeIcon = new LazyIcon("clear");
switchJTemplate(getTemplateIndex(evtX)); switchJTemplate(getTemplateIndex(evtX));
isShowList = false; isShowList = false;

3
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -5,7 +5,6 @@ package com.fr.design.file;
import com.fanruan.repository.TemplateRepository; import com.fanruan.repository.TemplateRepository;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.cache.DesignCacheManager;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fun.TemplateTreeDefineProcessor; import com.fr.design.fun.TemplateTreeDefineProcessor;
import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.gui.itree.filetree.TemplateFileTree;
@ -105,7 +104,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
return; return;
} }
if (evt.getClickCount() == 2) { if (evt.getClickCount() == 2) {
DesignCacheManager.processByCacheTableData(() -> openFile()); openFile();
} }
} }

1
designer-realize/src/main/java/com/fanruan/boot/env/DesignFunctionComponent.java vendored

@ -1,6 +1,5 @@
package com.fanruan.boot.env; package com.fanruan.boot.env;
import com.fanruan.carina.annotions.ActivatorRefer;
import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.DependsOn;
import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.Start; import com.fanruan.carina.annotions.Start;

34
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java vendored

@ -7,47 +7,13 @@ import com.fanruan.carina.annotions.FineComponent;
import com.fanruan.carina.annotions.Start; import com.fanruan.carina.annotions.Start;
import com.fanruan.carina.annotions.Supplemental; import com.fanruan.carina.annotions.Supplemental;
import com.fanruan.carina.core.partition.ResourceAffiliate; import com.fanruan.carina.core.partition.ResourceAffiliate;
import com.fr.base.OptimizeUtil;
import com.fr.collect.Collect;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.record.analyzer.DesignerAnalyzer;
import com.fr.design.record.analyzer.Interceptor.CollectInterceptor;
import com.fr.design.record.analyzer.advice.CollectAdvice;
import com.fr.design.record.analyzer.advice.DBMonitorAdvice;
import com.fr.design.record.analyzer.advice.FaultToleranceAdvice;
import com.fr.design.record.analyzer.advice.FocusAdvice;
import com.fr.design.record.analyzer.advice.MonitorAdvice;
import com.fr.design.record.analyzer.advice.PerformancePointAdvice;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.intelli.metrics.Compute;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.PerformancePoint;
import com.fr.jvm.assist.FineAssist;
import com.fr.record.analyzer.AnalyzerConfiguration; import com.fr.record.analyzer.AnalyzerConfiguration;
import com.fr.record.analyzer.AnalyzerKey;
import com.fr.record.analyzer.Assistant;
import com.fr.record.analyzer.DBMetrics;
import com.fr.record.analyzer.FineAnalyzer;
import com.fr.record.analyzer.advice.AnalyzerAdviceKey;
import com.fr.record.analyzer.advice.FineAdviceAssistant; import com.fr.record.analyzer.advice.FineAdviceAssistant;
import com.fr.record.analyzer.configuration.AnalyzerAssemblyFactory; import com.fr.record.analyzer.configuration.AnalyzerAssemblyFactory;
import com.fr.record.analyzer.configuration.FineAnalyzerAssemblyFactory; import com.fr.record.analyzer.configuration.FineAnalyzerAssemblyFactory;
import com.fr.stable.collections.CollectionUtils;
import com.fr.third.net.bytebuddy.description.type.TypeDescription;
import com.fr.third.net.bytebuddy.dynamic.DynamicType;
import com.fr.third.net.bytebuddy.implementation.MethodDelegation;
import com.fr.third.net.bytebuddy.matcher.ElementMatchers;
import com.fr.third.net.bytebuddy.utility.JavaModule;
import com.fr.tolerance.FaultTolerance;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
/** /**
* 设计器埋点及分析组件 * 设计器埋点及分析组件

5
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java vendored

@ -43,9 +43,11 @@ import com.fr.decision.webservice.v10.datasource.dataset.processor.impl.DataSetP
import com.fr.design.data.datapane.connect.LocalConnectionSource; import com.fr.design.data.datapane.connect.LocalConnectionSource;
import com.fr.design.data.tabledata.LocalTableDataSource; import com.fr.design.data.tabledata.LocalTableDataSource;
import com.fr.file.TableDataConfigWrapper; import com.fr.file.TableDataConfigWrapper;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import com.fr.workspace.server.repository.connection.ConnectionWriterShell; import com.fr.workspace.server.repository.connection.ConnectionWriterShell;
import com.fr.workspace.server.repository.connection.LocalConnectionShell; import com.fr.workspace.server.repository.connection.LocalConnectionShell;
import com.fr.workspace.server.repository.tabledata.LocalTableDataShell; import com.fr.workspace.server.repository.tabledata.LocalTableDataShell;
import com.fr.workspace.server.repository.tabledata.TableDataRepository;
/** /**
@ -102,7 +104,8 @@ public class DesignDatasourceComponent extends DatasourceComponent {
*/ */
@Stop @Stop
public void stop() { public void stop() {
ConnectionRepository.getInstance().invalidCache();
TableDataRepository.getInstance().invalidCache();
} }
/** /**

3
designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java vendored

@ -10,6 +10,7 @@ import com.fr.design.mainframe.App;
import com.fr.design.mainframe.AppGroup; import com.fr.design.mainframe.AppGroup;
import com.fr.design.mainframe.JTemplateFactory; import com.fr.design.mainframe.JTemplateFactory;
import com.fr.nx.app.designer.CptxApp; import com.fr.nx.app.designer.CptxApp;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -43,7 +44,7 @@ public class DesignAppComponent {
*/ */
@Stop @Stop
public void stop() { public void stop() {
RemoteAuthorityRepository.getInstance().invalidCache();
List<App> appList = new ArrayList<>(Carina.getApplicationContext().group(AppGroup.class).getAll()); List<App> appList = new ArrayList<>(Carina.getApplicationContext().group(AppGroup.class).getAll());
for (App app : appList) { for (App app : appList) {
JTemplateFactory.remove(app); JTemplateFactory.remove(app);

13
designer-realize/src/main/java/com/fanruan/boot/pre/DesignPreStartComponent.java

@ -1,12 +1,6 @@
package com.fanruan.boot.pre; package com.fanruan.boot.pre;
import com.fanruan.boot.FSProperties; import com.fanruan.boot.FSProperties;
import com.fanruan.fs.FileServer;
import com.fanruan.fs.RepositoryFactory;
import com.fanruan.fs.repository.local.LocalFileRepository;
import com.fanruan.product.ProductConstants;
import com.fr.decision.inject.node.impl.DecisionSystemInjectNode;
import com.fr.design.ConfigHelper;
import com.fanruan.boot.key.StartupArgsShell; import com.fanruan.boot.key.StartupArgsShell;
import com.fanruan.carina.Carina; import com.fanruan.carina.Carina;
import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.FineComponent;
@ -18,11 +12,17 @@ import com.fanruan.config.impl.ShareConfigProviderImpl;
import com.fanruan.config.realm.ConfigRealm; import com.fanruan.config.realm.ConfigRealm;
import com.fanruan.config.realm.ConfigRepositoryFactory; import com.fanruan.config.realm.ConfigRepositoryFactory;
import com.fanruan.config.realm.local.LocalConfigRepositoryBuilder; import com.fanruan.config.realm.local.LocalConfigRepositoryBuilder;
import com.fanruan.fs.FileServer;
import com.fanruan.fs.RepositoryFactory;
import com.fanruan.fs.repository.local.LocalFileRepository;
import com.fanruan.mq.CarinaMQ; import com.fanruan.mq.CarinaMQ;
import com.fanruan.mq.InternalMQProvider; import com.fanruan.mq.InternalMQProvider;
import com.fanruan.product.ProductConstants;
import com.fr.base.function.UITerminator; import com.fr.base.function.UITerminator;
import com.fr.carina.util.CarinaResourceUtils; import com.fr.carina.util.CarinaResourceUtils;
import com.fr.carina.util.provider.CarinaResourceProvider; import com.fr.carina.util.provider.CarinaResourceProvider;
import com.fr.decision.inject.node.impl.DecisionSystemInjectNode;
import com.fr.design.ConfigHelper;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.DesignerLaunchStatus; import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.deeplink.DeepLinkManager; import com.fr.design.deeplink.DeepLinkManager;
@ -47,7 +47,6 @@ import com.fr.module.engine.event.LifecycleErrorEvent;
import com.fr.runtime.FineRuntime; import com.fr.runtime.FineRuntime;
import com.fr.stable.CommonCodeUtils; import com.fr.stable.CommonCodeUtils;
import com.fr.stable.CommonUtils; import com.fr.stable.CommonUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.lifecycle.FineLifecycleFatalError; import com.fr.stable.lifecycle.FineLifecycleFatalError;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;

3
designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewWorkBookAction.java

@ -3,7 +3,6 @@ package com.fr.design.actions.file.newReport;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.cache.DesignCacheManager;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JWorkBook; import com.fr.design.mainframe.JWorkBook;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
@ -35,7 +34,7 @@ public class NewWorkBookAction extends UpdateAction {
* @param e 事件 * @param e 事件
*/ */
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
DesignCacheManager.processByCacheTableData(() -> DesignerContext.getDesignerFrame().addAndActivateJTemplate(new JWorkBook())); DesignerContext.getDesignerFrame().addAndActivateJTemplate(new JWorkBook());
} }
public static final MenuKeySet NEW_WORK_BOOK = new MenuKeySet() { public static final MenuKeySet NEW_WORK_BOOK = new MenuKeySet() {

Loading…
Cancel
Save