|
|
|
@ -23,7 +23,7 @@ import cn.hippo4j.common.executor.support.RejectedPolicyTypeEnum;
|
|
|
|
|
import cn.hippo4j.common.toolkit.ReflectUtil;
|
|
|
|
|
import cn.hippo4j.common.toolkit.StringUtil;
|
|
|
|
|
import cn.hippo4j.config.springboot.starter.config.BootstrapConfigProperties;
|
|
|
|
|
import cn.hippo4j.config.springboot.starter.config.DynamicThreadPoolNotifyProperties;
|
|
|
|
|
import cn.hippo4j.common.api.ExecutorNotifyProperties;
|
|
|
|
|
import cn.hippo4j.config.springboot.starter.config.ExecutorProperties;
|
|
|
|
|
import cn.hippo4j.core.executor.DynamicThreadPool;
|
|
|
|
|
import cn.hippo4j.core.executor.DynamicThreadPoolExecutor;
|
|
|
|
@ -229,7 +229,7 @@ public final class DynamicThreadPoolPostProcessor implements BeanPostProcessor {
|
|
|
|
|
* @return thread-pool notify alarm
|
|
|
|
|
*/
|
|
|
|
|
private ThreadPoolNotifyAlarm buildThreadPoolNotifyAlarm(ExecutorProperties executorProperties) {
|
|
|
|
|
DynamicThreadPoolNotifyProperties notify = Optional.ofNullable(executorProperties).map(ExecutorProperties::getNotify).orElse(null);
|
|
|
|
|
ExecutorNotifyProperties notify = Optional.ofNullable(executorProperties).map(ExecutorProperties::getNotify).orElse(null);
|
|
|
|
|
boolean isAlarm = Optional.ofNullable(executorProperties.getAlarm())
|
|
|
|
|
.orElseGet(() -> Optional.ofNullable(configProperties.getDefaultExecutor()).map(ExecutorProperties::getAlarm).orElse(true));
|
|
|
|
|
int activeAlarm = Optional.ofNullable(executorProperties.getActiveAlarm())
|
|
|
|
@ -237,11 +237,11 @@ public final class DynamicThreadPoolPostProcessor implements BeanPostProcessor {
|
|
|
|
|
int capacityAlarm = Optional.ofNullable(executorProperties.getCapacityAlarm())
|
|
|
|
|
.orElseGet(() -> Optional.ofNullable(configProperties.getDefaultExecutor()).map(ExecutorProperties::getCapacityAlarm).orElse(80));
|
|
|
|
|
int interval = Optional.ofNullable(notify)
|
|
|
|
|
.map(DynamicThreadPoolNotifyProperties::getInterval)
|
|
|
|
|
.orElseGet(() -> Optional.ofNullable(configProperties.getDefaultExecutor()).map(ExecutorProperties::getNotify).map(DynamicThreadPoolNotifyProperties::getInterval).orElse(5));
|
|
|
|
|
.map(ExecutorNotifyProperties::getInterval)
|
|
|
|
|
.orElseGet(() -> Optional.ofNullable(configProperties.getDefaultExecutor()).map(ExecutorProperties::getNotify).map(ExecutorNotifyProperties::getInterval).orElse(5));
|
|
|
|
|
String receive = Optional.ofNullable(notify)
|
|
|
|
|
.map(DynamicThreadPoolNotifyProperties::getReceives)
|
|
|
|
|
.orElseGet(() -> Optional.ofNullable(configProperties.getDefaultExecutor()).map(ExecutorProperties::getNotify).map(DynamicThreadPoolNotifyProperties::getReceives).orElse(""));
|
|
|
|
|
.map(ExecutorNotifyProperties::getReceives)
|
|
|
|
|
.orElseGet(() -> Optional.ofNullable(configProperties.getDefaultExecutor()).map(ExecutorProperties::getNotify).map(ExecutorNotifyProperties::getReceives).orElse(""));
|
|
|
|
|
ThreadPoolNotifyAlarm threadPoolNotifyAlarm = new ThreadPoolNotifyAlarm(isAlarm, activeAlarm, capacityAlarm);
|
|
|
|
|
threadPoolNotifyAlarm.setInterval(interval);
|
|
|
|
|
threadPoolNotifyAlarm.setReceives(receive);
|
|
|
|
|