We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@OverRide protected void beforeExecute(Thread t, Runnable r) { // 案例1 :executeTimeOut :变更前 1,变更后 0 // 案例2 :executeTimeOut :变更前 0,变更后 1 if (executeTimeOut == null || executeTimeOut <= 0) { return; } // 案例1 :executeTimeOut :变更前 1 // 案例2 :executeTimeOut :变更前 0,此时startTime空 this.startTime.set(SystemClock.now()); } @OverRide protected void afterExecute(Runnable r, Throwable t) { // 案例1 :executeTimeOut :变更后 0,此时直接返回了,不会执行 this.startTime.remove(); // 案例2 :executeTimeOut :变更后 1, long startTime = this.startTime.get(); NPE if (executeTimeOut == null || executeTimeOut <= 0) { return; } try { long startTime = this.startTime.get(); long endTime = SystemClock.now(); long executeTime; boolean executeTimeAlarm = (executeTime = (endTime - startTime)) > executeTimeOut; if (executeTimeAlarm && ApplicationContextHolder.getInstance() != null) { ThreadPoolNotifyAlarmHandler notifyAlarmHandler = ApplicationContextHolder.getBean(ThreadPoolNotifyAlarmHandler.class); if (notifyAlarmHandler != null) { notifyAlarmHandler.asyncSendExecuteTimeOutAlarm(threadPoolId, executeTime, executeTimeOut, this); } } } finally { this.startTime.remove(); } }
The text was updated successfully, but these errors were encountered:
@lizhifuabc 感谢反馈,如果有兴趣的话,可以提交个 pr。如无反馈,最近我会修复这个问题。
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
@OverRide
protected void beforeExecute(Thread t, Runnable r) {
// 案例1 :executeTimeOut :变更前 1,变更后 0
// 案例2 :executeTimeOut :变更前 0,变更后 1
if (executeTimeOut == null || executeTimeOut <= 0) {
return;
}
// 案例1 :executeTimeOut :变更前 1
// 案例2 :executeTimeOut :变更前 0,此时startTime空
this.startTime.set(SystemClock.now());
}
@OverRide
protected void afterExecute(Runnable r, Throwable t) {
// 案例1 :executeTimeOut :变更后 0,此时直接返回了,不会执行 this.startTime.remove();
// 案例2 :executeTimeOut :变更后 1, long startTime = this.startTime.get(); NPE
if (executeTimeOut == null || executeTimeOut <= 0) {
return;
}
try {
long startTime = this.startTime.get();
long endTime = SystemClock.now();
long executeTime;
boolean executeTimeAlarm = (executeTime = (endTime - startTime)) > executeTimeOut;
if (executeTimeAlarm && ApplicationContextHolder.getInstance() != null) {
ThreadPoolNotifyAlarmHandler notifyAlarmHandler = ApplicationContextHolder.getBean(ThreadPoolNotifyAlarmHandler.class);
if (notifyAlarmHandler != null) {
notifyAlarmHandler.asyncSendExecuteTimeOutAlarm(threadPoolId, executeTime, executeTimeOut, this);
}
}
} finally {
this.startTime.remove();
}
}
The text was updated successfully, but these errors were encountered: