java.lang.Object
cn.wjybxx.base.concurrent.CancelCodes
取消码辅助类
- 作者:
- wjybxx date - 2024/4/11
-
字段概要
字段修饰符和类型字段说明static final int紧迫程度的掩码(4it)-- 0表示未指定static final int表示取消信号来自Future的取消接口static final int中断的掩码 (1bit)static final int原因的掩码 1.如果cancelCode不包含其它信息,就等于reason 2.设定为20位,可达到100Wstatic final int预留4bitstatic final int告知任务无需执行删除逻辑 -- 慎用static final int最大紧急程度static final int最大取消原因static final int紧急度的偏移量static final int取消原因的偏移量static final int默认原因static final intExecutor关闭 -- Executor关闭不一定会取消任务static final int执行超时 -
方法概要
修饰符和类型方法说明static intcheckCode(int code) 检查取消码的合法性static intgetDegree(int code) 计算取消码终归的紧急程度static intgetReason(int code) 计算取消码中的原因static booleanisCancelling(int code) 取消码是否表示已收到取消信号static booleanisFromFuture(int code) 取消信号是否来自future接口static booleanisInterruptible(int code) 取消指令中是否要求了中断线程static booleanisWithoutRemove(int code) 取消指令中是否要求了无需删除static intsetDegree(int code, int value) 设置紧急程度static intsetInterruptible(int code, boolean value) 设置中断标记static intsetReason(int code, int value) 设置取消原因static intsetWithoutRemove(int code, boolean value) 设置是否不立即删除
-
字段详细资料
-
MASK_REASON
public static final int MASK_REASON原因的掩码 1.如果cancelCode不包含其它信息,就等于reason 2.设定为20位,可达到100W- 另请参阅:
-
MASK_DEGREE
public static final int MASK_DEGREE紧迫程度的掩码(4it)-- 0表示未指定- 另请参阅:
-
MASK_REVERSED
public static final int MASK_REVERSED预留4bit- 另请参阅:
-
MASK_INTERRUPT
public static final int MASK_INTERRUPT中断的掩码 (1bit)- 另请参阅:
-
MASK_WITHOUT_REMOVE
public static final int MASK_WITHOUT_REMOVE告知任务无需执行删除逻辑 -- 慎用- 另请参阅:
-
MASK_FROM_FUTURE
public static final int MASK_FROM_FUTURE表示取消信号来自Future的取消接口- 另请参阅:
-
MAX_REASON
public static final int MAX_REASON最大取消原因- 另请参阅:
-
MAX_DEGREE
public static final int MAX_DEGREE最大紧急程度- 另请参阅:
-
OFFSET_REASON
public static final int OFFSET_REASON取消原因的偏移量- 另请参阅:
-
OFFSET_DEGREE
public static final int OFFSET_DEGREE紧急度的偏移量- 另请参阅:
-
REASON_DEFAULT
public static final int REASON_DEFAULT默认原因- 另请参阅:
-
REASON_TIMEOUT
public static final int REASON_TIMEOUT执行超时- 另请参阅:
-
REASON_SHUTDOWN
public static final int REASON_SHUTDOWNExecutor关闭 -- Executor关闭不一定会取消任务- 另请参阅:
-
-
方法详细资料
-
isCancelling
public static boolean isCancelling(int code) 取消码是否表示已收到取消信号 -
getReason
public static int getReason(int code) 计算取消码中的原因 -
getDegree
public static int getDegree(int code) 计算取消码终归的紧急程度 -
isInterruptible
public static boolean isInterruptible(int code) 取消指令中是否要求了中断线程 -
isWithoutRemove
public static boolean isWithoutRemove(int code) 取消指令中是否要求了无需删除 -
isFromFuture
public static boolean isFromFuture(int code) 取消信号是否来自future接口 -
setDegree
public static int setDegree(int code, int value) 设置紧急程度 -
setReason
public static int setReason(int code, int value) 设置取消原因 -
setInterruptible
public static int setInterruptible(int code, boolean value) 设置中断标记 -
setWithoutRemove
public static int setWithoutRemove(int code, boolean value) 设置是否不立即删除 -
checkCode
public static int checkCode(int code) 检查取消码的合法性- 返回:
- argument
-