Browse Source

REPORT-18494 线程池命名

research/10.0
vito 6 years ago
parent
commit
9194307c92
  1. 10
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  2. 6
      designer-base/src/main/java/com/fr/start/ServerStarter.java
  3. 3
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java
  4. 3
      designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java
  5. 3
      designer-realize/src/main/java/com/fr/start/SplashContext.java
  6. 3
      designer-realize/src/main/java/com/fr/start/fx/SplashFx.java
  7. 3
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java
  8. 5
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java
  9. 3
      designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java
  10. 3
      designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java

10
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -2,6 +2,7 @@ package com.fr.design.utils;
import com.fr.base.FeedBackInfo;
import com.fr.base.ServerConfig;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.DesignerEnvProcessor;
@ -116,7 +117,7 @@ public class DesignUtils {
* @param suffixs 文件后缀
*/
public static void createListeningServer(final int startPort, final String[] suffixs) {
ExecutorService service = Executors.newSingleThreadExecutor();
ExecutorService service = Executors.newSingleThreadExecutor(new NamedThreadFactory("DesignClientListener"));
service.execute(new Runnable() {
@Override
public void run() {
@ -129,7 +130,8 @@ public class DesignUtils {
while (true) {
try {
if (serverSocket != null) {
Socket socket = serverSocket.accept(); // 接收客户连接
// 接收客户连接
Socket socket = serverSocket.accept();
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8));
String line;
while ((line = reader.readLine()) != null) {
@ -141,8 +143,8 @@ public class DesignUtils {
String path = f.getAbsolutePath();
boolean isMatch = false;
for (int i = 0; i < suffixs.length; i++) {
isMatch = isMatch || path.endsWith(suffixs[i]);
for (String suffix : suffixs) {
isMatch = isMatch || path.endsWith(suffix);
}
if (isMatch) {
DesignerContext.getDesignerFrame().openTemplate(new FileFILE(f));

6
designer-base/src/main/java/com/fr/start/ServerStarter.java

@ -1,6 +1,7 @@
package com.fr.start;
import com.fr.base.ServerConfig;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.ComparatorUtils;
@ -24,8 +25,7 @@ public class ServerStarter {
if (!WorkContext.getCurrent().isLocal()) {
//有问题,这里拿不到远程的http端口
BrowseUtils.browser(WorkContext.getCurrent().getPath());
}
else if (ComparatorUtils.equals(StableUtils.getInstallHome(), ".")) {//august:供代码使用
} else if (ComparatorUtils.equals(StableUtils.getInstallHome(), ".")) {//august:供代码使用
String web = GeneralContext.getCurrentAppNameOfEnv();
browserURLWithLocalEnv("http://localhost:" + DesignerEnvManager.getEnvManager().getEmbedServerPort() + "/" + web + "/" + ServerConfig.getInstance().getServletName());
} else {
@ -54,7 +54,7 @@ public class ServerStarter {
if (!FineEmbedServerMonitor.getInstance().isComplete()) {
FineEmbedServerMonitor.getInstance().monitor();
ExecutorService service = Executors.newSingleThreadExecutor();
ExecutorService service = Executors.newSingleThreadExecutor(new NamedThreadFactory("ServerStarter"));
service.submit(new Runnable() {
@Override

3
designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java

@ -1,5 +1,6 @@
package com.fr.start.server;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
@ -66,7 +67,7 @@ public class FineEmbedServerMonitor {
}
public void monitor() {
ExecutorService service = Executors.newSingleThreadExecutor();
ExecutorService service = Executors.newSingleThreadExecutor(new NamedThreadFactory("FineEmbedServerMonitor"));
service.submit(new Runnable() {
@Override

3
designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java

@ -4,6 +4,7 @@
package com.fr.design.mainframe;
import com.fr.base.FRContext;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.errorinfo.ErrorInfoUploader;
@ -196,7 +197,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
return;
}
ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("InformationCollector"));
service.schedule(new Runnable() {
@Override
public void run() {

3
designer-realize/src/main/java/com/fr/start/SplashContext.java

@ -1,5 +1,6 @@
package com.fr.start;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.bbs.BBSConstants;
import com.fr.event.Event;
@ -38,7 +39,7 @@ public class SplashContext {
private int fetchOnlineTimes = 0;
private String guest = StringUtils.EMPTY;
private ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
private ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1, new NamedThreadFactory("SplashContext"));
private Listener<String> listener;

3
designer-realize/src/main/java/com/fr/start/fx/SplashFx.java

@ -1,5 +1,6 @@
package com.fr.start.fx;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.start.SplashFxActionListener;
import com.fr.start.SplashStrategy;
@ -21,7 +22,7 @@ import java.util.concurrent.Executors;
public class SplashFx implements SplashStrategy {
private SplashFxWindow fxWindow;
private static final ExecutorService SERVICE = Executors.newSingleThreadExecutor();
private static final ExecutorService SERVICE = Executors.newSingleThreadExecutor(new NamedThreadFactory("SplashFx"));
@Override
public void show() {

3
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -5,6 +5,7 @@ import com.fr.base.Formula;
import com.fr.base.MultiFieldParameter;
import com.fr.base.process.ProcessOperator;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.NewFormAction;
import com.fr.design.actions.core.ActionFactory;
@ -169,7 +170,7 @@ public class DesignerActivator extends Activator {
}
private static void preLoadPane() {
ExecutorService service = Executors.newCachedThreadPool();
ExecutorService service = Executors.newCachedThreadPool(new NamedThreadFactory("PreLoadPane"));
service.submit(new Runnable() {
@Override
public void run() {

5
designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java

@ -1,5 +1,6 @@
package com.fr.start.module;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.event.Event;
import com.fr.event.Listener;
@ -24,7 +25,6 @@ public class DesignerWorkspaceActivator extends Activator {
startServer(WorkContext.getCurrent());
}
/**
* 注册切换环境前后事件监听
*/
@ -74,12 +74,11 @@ public class DesignerWorkspaceActivator extends Activator {
// 切换后的环境是本地环境才启动内置服务器
if (current.isLocal()) {
ExecutorService service = Executors.newSingleThreadExecutor();
ExecutorService service = Executors.newSingleThreadExecutor(new NamedThreadFactory("DesignerWorkspaceActivator"));
service.submit(new Runnable() {
@Override
public void run() {
FineEmbedServer.start();
}
});

3
designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java

@ -1,5 +1,6 @@
package com.fr.start.module;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper;
import com.fr.design.fun.OemProcessor;
@ -116,7 +117,7 @@ public class PreStartActivator extends Activator {
private static void preloadResource() {
ExecutorService service = Executors.newCachedThreadPool();
ExecutorService service = Executors.newCachedThreadPool(new NamedThreadFactory("PreLoadResource"));
service.submit(new Runnable() {

3
designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java

@ -1,5 +1,6 @@
package com.fr.start.preload;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.general.IOUtils;
import java.util.concurrent.ExecutorService;
@ -13,7 +14,7 @@ public class ImagePreLoader {
public static final int THRESHOLD = 50;
public ImagePreLoader() {
ExecutorService service = Executors.newCachedThreadPool();
ExecutorService service = Executors.newCachedThreadPool(new NamedThreadFactory("ImagePreLoader"));
int len = preLoadImages.length;
int start = 0;

Loading…
Cancel
Save