Browse Source

REPORT-48135 修复线程池调用方式

fix-lag
loy 3 years ago
parent
commit
1a0fc19d1a
  1. 6
      designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformer.java

6
designer-base/src/main/java/com/fr/nx/app/designer/transform/BatchTransformer.java

@ -2,7 +2,6 @@ package com.fr.nx.app.designer.transform;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.file.filetree.FileNode;
import com.fr.plugin.context.PluginContexts;
import com.fr.nx.app.designer.toolbar.TransformResultInfo;
import com.fr.nx.app.designer.utils.CompileTransformUtil;
@ -10,6 +9,7 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created by kerry on 2019-12-10
@ -21,7 +21,7 @@ public class BatchTransformer {
private static final int MAXPOOLSIZE = 5;
private static final String THREAD_NAME_TEMPLATE = "batchtransform-thread-%s";
private ExecutorService threadPoolExecutor =
PluginContexts.currentContext().newFixedThreadPool(MAXPOOLSIZE,
Executors.newFixedThreadPool(MAXPOOLSIZE,
new ThreadFactoryBuilder().setNameFormat(THREAD_NAME_TEMPLATE).build());
public BatchTransformer(UpdateCallBack updateCallBack) {
@ -59,7 +59,7 @@ public class BatchTransformer {
if (threadPoolExecutor != null) {
threadPoolExecutor.shutdownNow();
}
threadPoolExecutor = PluginContexts.currentContext().newFixedThreadPool(MAXPOOLSIZE,
threadPoolExecutor = Executors.newFixedThreadPool(MAXPOOLSIZE,
new ThreadFactoryBuilder().setNameFormat(THREAD_NAME_TEMPLATE).build());
updateCallBack.shutDown();
}

Loading…
Cancel
Save