When the number of dynamic thread pools is empty, there is a CPU idling problem (#803)

pull/802/head
chen.ma 2 years ago
parent eca7b8b197
commit 2f2f7d4b82

@ -1,6 +1,7 @@
server.port=8090
spring.profiles.active=dev
spring.application.name=springcloud-rocketmq-stream-example
spring.dynamic.thread-pool.server-addr=http://localhost:6691
spring.dynamic.thread-pool.namespace=prescription
spring.dynamic.thread-pool.item-id=dynamic-threadpool-example

@ -18,6 +18,7 @@
package cn.hippo4j.springboot.starter.core;
import cn.hippo4j.common.model.ThreadPoolParameterInfo;
import cn.hippo4j.common.toolkit.CollectionUtil;
import cn.hippo4j.common.toolkit.ContentUtil;
import cn.hippo4j.common.toolkit.GroupKey;
import cn.hippo4j.common.toolkit.IdUtil;
@ -91,7 +92,9 @@ public class ClientWorker {
this.executor.schedule(() -> {
try {
awaitApplicationComplete.await();
executorService.execute(new LongPollingRunnable());
if (CollectionUtil.isNotEmpty(cacheMap)) {
executorService.execute(new LongPollingRunnable());
}
} catch (Throwable ex) {
log.error("Sub check rotate check error.", ex);
}

Loading…
Cancel
Save