feat: 新增可计数的拒绝策略.

This commit is contained in:
2025-03-05 14:50:36 +08:00
parent f7e4400e37
commit af9c1c9622
6 changed files with 83 additions and 9 deletions

View File

@@ -0,0 +1,27 @@
package com.serliunx.statemanagement.support;
import java.util.concurrent.RejectedExecutionHandler;
/**
* 附带计数的拒绝策略
*
* @author <a href="mailto:serliunx@yeah.net">SerLiunx</a>
* @version 1.0.0
* @since 2025/3/5
*/
public interface CountableRejectedExecutionHandler extends RejectedExecutionHandler {
/**
* 获取当前拒绝的任务数量
*
* @return 当目前为止所拒绝的任务数量
*/
long getCount();
/**
* 获取最后一次被拒绝的任务
*
* @return 最后一次被拒绝的任务
*/
Runnable getLastRejectedTask();
}