删除 starter 组件中相关报警 api. (#100)

pull/104/head
chen.ma 3 years ago
parent 2fc576c56c
commit b4719afa84

@ -39,7 +39,12 @@ public class ThreadPoolAlarmManage {
if (SEND_MESSAGE_SERVICE == null) {
return;
}
ThreadPoolAlarm threadPoolAlarm = threadPoolExecutor.getThreadPoolAlarm();
/**
* TODO
* https://github.com/acmenlt/dynamic-threadpool/issues/100
*/
ThreadPoolAlarm threadPoolAlarm = new ThreadPoolAlarm(null, 80, 80);
BlockingQueue blockIngQueue = threadPoolExecutor.getQueue();
int queueSize = blockIngQueue.size();
@ -67,8 +72,11 @@ public class ThreadPoolAlarmManage {
int maximumPoolSize = threadPoolExecutor.getMaximumPoolSize();
int divide = CalculateUtil.divide(activeCount, maximumPoolSize);
ThreadPoolAlarm threadPoolAlarm = threadPoolExecutor.getThreadPoolAlarm();
/**
* TODO
* https://github.com/acmenlt/dynamic-threadpool/issues/100
*/
ThreadPoolAlarm threadPoolAlarm = new ThreadPoolAlarm(null, 80, 80);
boolean isSend = threadPoolAlarm.getIsAlarm()
&& divide > threadPoolAlarm.getLivenessAlarm()
&& isSendMessage(threadPoolExecutor, MessageTypeEnum.LIVENESS);
@ -87,7 +95,11 @@ public class ThreadPoolAlarmManage {
return;
}
ThreadPoolAlarm threadPoolAlarm = threadPoolExecutor.getThreadPoolAlarm();
/**
* TODO
* https://github.com/acmenlt/dynamic-threadpool/issues/100
*/
ThreadPoolAlarm threadPoolAlarm = new ThreadPoolAlarm(null, 80, 80);
if (threadPoolAlarm.getIsAlarm() && isSendMessage(threadPoolExecutor, MessageTypeEnum.REJECT)) {
SEND_MESSAGE_SERVICE.sendAlarmMessage(MessageTypeEnum.REJECT, threadPoolExecutor);
}

@ -138,7 +138,6 @@ public final class DynamicThreadPoolPostProcessor implements BeanPostProcessor {
.poolThreadSize(ppi.getCoreSize(), ppi.getMaxSize())
.keepAliveTime(ppi.getKeepAliveTime(), TimeUnit.SECONDS)
.rejected(RejectedTypeEnum.createPolicy(ppi.getRejectedType()))
.alarmConfig(ppi.getIsAlarm(), ppi.getCapacityAlarm(), ppi.getLivenessAlarm())
.allowCoreThreadTimeOut(EnableEnum.getBool(ppi.getAllowCoreThreadTimeOut()))
.build();

@ -1,7 +1,6 @@
package cn.hippo4j.starter.toolkit.thread;
import cn.hippo4j.common.toolkit.Assert;
import cn.hippo4j.starter.alarm.ThreadPoolAlarm;
import cn.hippo4j.starter.core.DynamicThreadPoolExecutor;
import lombok.Data;
import lombok.experimental.Accessors;
@ -121,7 +120,6 @@ public class AbstractBuildThreadPoolTemplate {
initParam.getWorkQueue(),
initParam.getThreadPoolId(),
initParam.getThreadFactory(),
initParam.getThreadPoolAlarm(),
initParam.getRejectedExecutionHandler()
);
} catch (IllegalArgumentException ex) {
@ -182,11 +180,6 @@ public class AbstractBuildThreadPoolTemplate {
*/
private String threadPoolId;
/**
*
*/
private ThreadPoolAlarm threadPoolAlarm;
/**
* 线
*/

@ -1,9 +1,7 @@
package cn.hippo4j.starter.toolkit.thread;
import cn.hippo4j.common.design.builder.Builder;
import cn.hippo4j.common.enums.EnableEnum;
import cn.hippo4j.common.toolkit.Assert;
import cn.hippo4j.starter.alarm.ThreadPoolAlarm;
import org.springframework.core.task.TaskDecorator;
import java.math.BigDecimal;
@ -88,16 +86,6 @@ public class ThreadPoolBuilder implements Builder<ThreadPoolExecutor> {
*/
private boolean isAlarm = false;
/**
*
*/
private Integer capacityAlarm;
/**
*
*/
private Integer livenessAlarm;
/**
* 线
*/
@ -212,13 +200,6 @@ public class ThreadPoolBuilder implements Builder<ThreadPoolExecutor> {
return this;
}
public ThreadPoolBuilder alarmConfig(int isAlarm, int capacityAlarm, int livenessAlarm) {
this.isAlarm = isAlarm == EnableEnum.YES.getIntCode() ? true : false;
this.capacityAlarm = capacityAlarm;
this.livenessAlarm = livenessAlarm;
return this;
}
public ThreadPoolBuilder taskDecorator(TaskDecorator taskDecorator) {
this.taskDecorator = taskDecorator;
return this;
@ -320,8 +301,6 @@ public class ThreadPoolBuilder implements Builder<ThreadPoolExecutor> {
if (builder.isDynamicPool) {
String threadPoolId = Optional.ofNullable(builder.threadPoolId).orElse(builder.threadNamePrefix);
initParam.setThreadPoolId(threadPoolId);
ThreadPoolAlarm threadPoolAlarm = new ThreadPoolAlarm(builder.isAlarm, builder.livenessAlarm, builder.capacityAlarm);
initParam.setThreadPoolAlarm(threadPoolAlarm);
initParam.setWaitForTasksToCompleteOnShutdown(builder.waitForTasksToCompleteOnShutdown);
initParam.setAwaitTerminationMillis(builder.awaitTerminationMillis);
}

Loading…
Cancel
Save