perf: 优化

pull/140/head
yangs 3 years ago
parent a306c4fdd4
commit 2210410c62

@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.concurrent.*; import java.util.concurrent.*;
/** /**
@ -134,7 +135,7 @@ public class ThreadPoolNotifyAlarmHandler implements Runnable, CommandLineRunner
*/ */
public void checkPoolRejectedAlarm(String threadPoolId) { public void checkPoolRejectedAlarm(String threadPoolId) {
ThreadPoolNotifyAlarm threadPoolNotifyAlarm = GlobalNotifyAlarmManage.get(threadPoolId); ThreadPoolNotifyAlarm threadPoolNotifyAlarm = GlobalNotifyAlarmManage.get(threadPoolId);
if (!threadPoolNotifyAlarm.getIsAlarm()) { if (Objects.isNull(threadPoolNotifyAlarm)||!threadPoolNotifyAlarm.getIsAlarm()) {
return; return;
} }

@ -16,7 +16,7 @@ public class GlobalNotifyAlarmManage {
/** /**
* Notify alarm map. * Notify alarm map.
*/ */
private static final Map<String, ThreadPoolNotifyAlarm> NOTIFY_ALARM_MAP = new ConcurrentHashMap(); private static final Map<String, ThreadPoolNotifyAlarm> NOTIFY_ALARM_MAP = new ConcurrentHashMap<>();
/** /**
* Get. * Get.

@ -30,10 +30,8 @@ public class RejectedProxyInvocationHandler implements InvocationHandler {
if (ApplicationContextHolder.getInstance() != null) { if (ApplicationContextHolder.getInstance() != null) {
ThreadPoolNotifyAlarmHandler alarmHandler = ApplicationContextHolder.getBean(ThreadPoolNotifyAlarmHandler.class); ThreadPoolNotifyAlarmHandler alarmHandler = ApplicationContextHolder.getBean(ThreadPoolNotifyAlarmHandler.class);
if (alarmHandler != null) {
alarmHandler.checkPoolRejectedAlarm(threadPoolId); alarmHandler.checkPoolRejectedAlarm(threadPoolId);
} }
}
try { try {
return method.invoke(target, args); return method.invoke(target, args);

Loading…
Cancel
Save