|
|
@ -41,7 +41,7 @@ import java.util.Objects;
|
|
|
|
import java.util.concurrent.*;
|
|
|
|
import java.util.concurrent.*;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Thread-pool alarm notify.
|
|
|
|
* Thread-pool notify alarm handler.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Slf4j
|
|
|
|
@Slf4j
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
@RequiredArgsConstructor
|
|
|
@ -109,8 +109,7 @@ public class ThreadPoolNotifyAlarmHandler implements Runnable, CommandLineRunner
|
|
|
|
int queueSize = blockingQueue.size();
|
|
|
|
int queueSize = blockingQueue.size();
|
|
|
|
int capacity = queueSize + blockingQueue.remainingCapacity();
|
|
|
|
int capacity = queueSize + blockingQueue.remainingCapacity();
|
|
|
|
int divide = CalculateUtil.divide(queueSize, capacity);
|
|
|
|
int divide = CalculateUtil.divide(queueSize, capacity);
|
|
|
|
boolean isSend = threadPoolNotifyAlarm.getAlarm()
|
|
|
|
boolean isSend = threadPoolNotifyAlarm.getAlarm() && divide > threadPoolNotifyAlarm.getCapacityAlarm();
|
|
|
|
&& divide > threadPoolNotifyAlarm.getCapacityAlarm();
|
|
|
|
|
|
|
|
if (isSend) {
|
|
|
|
if (isSend) {
|
|
|
|
AlarmNotifyRequest alarmNotifyRequest = buildAlarmNotifyReq(threadPoolExecutor);
|
|
|
|
AlarmNotifyRequest alarmNotifyRequest = buildAlarmNotifyReq(threadPoolExecutor);
|
|
|
|
alarmNotifyRequest.setThreadPoolId(threadPoolId);
|
|
|
|
alarmNotifyRequest.setThreadPoolId(threadPoolId);
|
|
|
@ -129,8 +128,7 @@ public class ThreadPoolNotifyAlarmHandler implements Runnable, CommandLineRunner
|
|
|
|
int maximumPoolSize = threadPoolExecutor.getMaximumPoolSize();
|
|
|
|
int maximumPoolSize = threadPoolExecutor.getMaximumPoolSize();
|
|
|
|
int divide = CalculateUtil.divide(activeCount, maximumPoolSize);
|
|
|
|
int divide = CalculateUtil.divide(activeCount, maximumPoolSize);
|
|
|
|
ThreadPoolNotifyAlarm threadPoolNotifyAlarm = GlobalNotifyAlarmManage.get(threadPoolId);
|
|
|
|
ThreadPoolNotifyAlarm threadPoolNotifyAlarm = GlobalNotifyAlarmManage.get(threadPoolId);
|
|
|
|
boolean isSend = threadPoolNotifyAlarm.getAlarm()
|
|
|
|
boolean isSend = threadPoolNotifyAlarm.getAlarm() && divide > threadPoolNotifyAlarm.getActiveAlarm();
|
|
|
|
&& divide > threadPoolNotifyAlarm.getActiveAlarm();
|
|
|
|
|
|
|
|
if (isSend) {
|
|
|
|
if (isSend) {
|
|
|
|
AlarmNotifyRequest alarmNotifyRequest = buildAlarmNotifyReq(threadPoolExecutor);
|
|
|
|
AlarmNotifyRequest alarmNotifyRequest = buildAlarmNotifyReq(threadPoolExecutor);
|
|
|
|
alarmNotifyRequest.setThreadPoolId(threadPoolId);
|
|
|
|
alarmNotifyRequest.setThreadPoolId(threadPoolId);
|
|
|
|