Commit 94fbc213 by 王祖波

线程池

parent f4a1601e
...@@ -5,6 +5,7 @@ import com.ctrip.framework.apollo.ConfigChangeListener; ...@@ -5,6 +5,7 @@ import com.ctrip.framework.apollo.ConfigChangeListener;
import com.ctrip.framework.apollo.ConfigService; import com.ctrip.framework.apollo.ConfigService;
import com.ctrip.framework.apollo.model.ConfigChange; import com.ctrip.framework.apollo.model.ConfigChange;
import com.ctrip.framework.apollo.model.ConfigChangeEvent; import com.ctrip.framework.apollo.model.ConfigChangeEvent;
import com.gic.commons.util.TraceIdUtil;
import com.gic.haoban.manage.api.qdto.combined.CombinedQDTO; import com.gic.haoban.manage.api.qdto.combined.CombinedQDTO;
import com.gic.haoban.manage.service.util.ApolloUtils; import com.gic.haoban.manage.service.util.ApolloUtils;
import com.github.benmanes.caffeine.cache.Cache; import com.github.benmanes.caffeine.cache.Cache;
...@@ -47,8 +48,8 @@ public class ImageCombined { ...@@ -47,8 +48,8 @@ public class ImageCombined {
.build(); .build();
public static final ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor( public static final ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor(
20, ApolloUtils.combinedCorePoolSize(),
40, ApolloUtils.combinedMaximumPoolSize(),
60L, 60L,
TimeUnit.SECONDS, TimeUnit.SECONDS,
new ArrayBlockingQueue<>(40), new ArrayBlockingQueue<>(40),
...@@ -59,6 +60,7 @@ public class ImageCombined { ...@@ -59,6 +60,7 @@ public class ImageCombined {
if (!StringUtils.equals(changeEvent.getNamespace(), APPLICATION)) { if (!StringUtils.equals(changeEvent.getNamespace(), APPLICATION)) {
return; return;
} }
TraceIdUtil.traceBegin(TraceIdUtil.EntranceType.QUARTZ);
ConfigChange combinedCorePoolSizeChange = changeEvent.getChange("combinedCorePoolSize"); ConfigChange combinedCorePoolSizeChange = changeEvent.getChange("combinedCorePoolSize");
ConfigChange combinedMaximumPoolSizeChange = changeEvent.getChange("combinedMaximumPoolSize"); ConfigChange combinedMaximumPoolSizeChange = changeEvent.getChange("combinedMaximumPoolSize");
if ((combinedCorePoolSizeChange != null && combinedCorePoolSizeChange.getNewValue() != null) if ((combinedCorePoolSizeChange != null && combinedCorePoolSizeChange.getNewValue() != null)
...@@ -69,6 +71,7 @@ public class ImageCombined { ...@@ -69,6 +71,7 @@ public class ImageCombined {
EXECUTOR.setCorePoolSize(corePoolSize); EXECUTOR.setCorePoolSize(corePoolSize);
EXECUTOR.setMaximumPoolSize(maximumPoolSize); EXECUTOR.setMaximumPoolSize(maximumPoolSize);
} }
TraceIdUtil.traceEnd();
} }
public static final String IMAGE_REDIS_KEY = "haoban-manage3-service:combined_image:"; public static final String IMAGE_REDIS_KEY = "haoban-manage3-service:combined_image:";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment