ApplicationContextHolder 适配非 Spring 环境.

pull/142/head
chen.ma 2 years ago
parent 24b7b2b0aa
commit 69973a8554

@ -91,7 +91,7 @@ public class DynamicThreadPoolExecutor extends AbstractDynamicExecutorSupport {
long endTime = System.currentTimeMillis();
long executeTime;
boolean executeTimeAlarm = (executeTime = (endTime - startTime)) > executeTimeOut;
if (executeTimeAlarm) {
if (executeTimeAlarm && ApplicationContextHolder.getInstance() != null) {
ThreadPoolNotifyAlarmHandler notifyAlarmHandler = ApplicationContextHolder.getBean(ThreadPoolNotifyAlarmHandler.class);
if (notifyAlarmHandler != null) {
notifyAlarmHandler.asyncSendExecuteTimeOutAlarm(threadPoolId, executeTime, executeTimeOut, this);

@ -30,11 +30,7 @@ public class RejectedProxyInvocationHandler implements InvocationHandler {
if (ApplicationContextHolder.getInstance() != null) {
ThreadPoolNotifyAlarmHandler alarmHandler = ApplicationContextHolder.getBean(ThreadPoolNotifyAlarmHandler.class);
try {
alarmHandler.checkPoolRejectedAlarm(threadPoolId);
} catch (Exception ignored) {
//ignored
}
alarmHandler.checkPoolRejectedAlarm(threadPoolId);
}
try {

Loading…
Cancel
Save