fix# 消费端使用动态线程池

master
3y 4 months ago
parent 2f781fe37a
commit 1060bdd803

@ -15,7 +15,7 @@ import java.util.concurrent.TimeUnit;
*/ */
public class HandlerThreadPoolConfig { public class HandlerThreadPoolConfig {
private static final String PRE_FIX = "austin."; public static final String PRE_FIX = "austin.";
private HandlerThreadPoolConfig() { private HandlerThreadPoolConfig() {

@ -1,5 +1,6 @@
package com.java3y.austin.handler.pending; package com.java3y.austin.handler.pending;
import com.dtp.core.DtpRegistry;
import com.dtp.core.thread.DtpExecutor; import com.dtp.core.thread.DtpExecutor;
import com.java3y.austin.handler.config.HandlerThreadPoolConfig; import com.java3y.austin.handler.config.HandlerThreadPoolConfig;
import com.java3y.austin.handler.utils.GroupIdMappingUtils; import com.java3y.austin.handler.utils.GroupIdMappingUtils;
@ -27,7 +28,6 @@ public class TaskPendingHolder {
private static List<String> groupIds = GroupIdMappingUtils.getAllGroupIds(); private static List<String> groupIds = GroupIdMappingUtils.getAllGroupIds();
@Autowired @Autowired
private ThreadPoolUtils threadPoolUtils; private ThreadPoolUtils threadPoolUtils;
private Map<String, ExecutorService> holder = new HashMap<>(32);
/** /**
* 线 * 线
@ -43,7 +43,6 @@ public class TaskPendingHolder {
DtpExecutor executor = HandlerThreadPoolConfig.getExecutor(groupId); DtpExecutor executor = HandlerThreadPoolConfig.getExecutor(groupId);
threadPoolUtils.register(executor); threadPoolUtils.register(executor);
holder.put(groupId, executor);
} }
} }
@ -54,7 +53,7 @@ public class TaskPendingHolder {
* @return * @return
*/ */
public ExecutorService route(String groupId) { public ExecutorService route(String groupId) {
return holder.get(groupId); return DtpRegistry.getExecutor(HandlerThreadPoolConfig.PRE_FIX + groupId);
} }

Loading…
Cancel
Save