* Simplified DynamicThreadPool usage

* Simplified DynamicThreadPool usage

* init

* update method name
pull/772/head
weihubeats 2 years ago committed by GitHub
parent 3c5c09a799
commit f9d8b5f993
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,6 +17,13 @@
package cn.hippo4j.adapter.web;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;
import java.util.concurrent.Executor;
import cn.hippo4j.common.constant.ChangeThreadPoolConstants;
import cn.hippo4j.common.model.ThreadPoolBaseInfo;
import cn.hippo4j.common.model.ThreadPoolParameter;
@ -26,19 +33,12 @@ import cn.hippo4j.common.toolkit.CalculateUtil;
import cn.hippo4j.core.executor.DynamicThreadPoolExecutor;
import io.undertow.Undertow;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.web.embedded.undertow.UndertowServletWebServer;
import org.springframework.boot.web.server.WebServer;
import org.springframework.util.ReflectionUtils;
import org.xnio.Options;
import org.xnio.XnioWorker;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Objects;
import java.util.concurrent.Executor;
import org.springframework.boot.web.embedded.undertow.UndertowServletWebServer;
import org.springframework.boot.web.server.WebServer;
import org.springframework.util.ReflectionUtils;
/**
* Undertow web thread pool handler.

@ -231,7 +231,7 @@ public class ThreadPoolBuilder implements Builder<ThreadPoolExecutor> {
* @param threadPoolId threadPoolId
* @return ThreadPoolExecutor
*/
public static ThreadPoolExecutor builderDynamicPoolById(String threadPoolId) {
public static ThreadPoolExecutor buildDynamicPoolById(String threadPoolId) {
return ThreadPoolBuilder.builder()
.threadFactory(threadPoolId)
.threadPoolId(threadPoolId)

@ -35,6 +35,6 @@ public class ThreadPoolConfig {
@SpringDynamicThreadPool
public ThreadPoolExecutor messageConsumeDynamicExecutor() {
String threadPoolId = "message-consume";
return ThreadPoolBuilder.builderDynamicPoolById(threadPoolId);
return ThreadPoolBuilder.buildDynamicPoolById(threadPoolId);
}
}

@ -65,7 +65,7 @@ public class DynamicThreadPoolConfig {
*/
@SpringDynamicThreadPool
public ThreadPoolExecutor messageProduceDynamicThreadPool() {
return ThreadPoolBuilder.builderDynamicPoolById(MESSAGE_PRODUCE);
return ThreadPoolBuilder.buildDynamicPoolById(MESSAGE_PRODUCE);
}
/**

@ -17,6 +17,12 @@
package cn.hippo4j.message.service;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
import cn.hippo4j.common.constant.Constants;
import cn.hippo4j.common.toolkit.IdUtil;
import cn.hippo4j.common.toolkit.StringUtil;
@ -24,12 +30,6 @@ import cn.hippo4j.message.dto.AlarmControlDTO;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
/**
* Alarm control assembly.
*/

@ -17,6 +17,10 @@
package cn.hippo4j.config.springboot.starter.refresher;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import cn.hippo4j.core.executor.manage.GlobalNotifyAlarmManage;
import cn.hippo4j.message.service.ThreadPoolNotifyAlarm;
import lombok.extern.slf4j.Slf4j;
@ -31,10 +35,6 @@ import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.curator.utils.ZKPaths;
import org.apache.zookeeper.WatchedEvent;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
/**
* Zookeeper refresher handler.
*/

Loading…
Cancel
Save