doc: 触发逻辑补充说明.
This commit is contained in:
@@ -263,13 +263,24 @@ public abstract class AbstractStateMachine<S> extends AbstractStateManager<S> im
|
|||||||
(stateHandler = hw.getStateHandler()) == null)
|
(stateHandler = hw.getStateHandler()) == null)
|
||||||
return;
|
return;
|
||||||
final StateHandlerProcessParams<S> params = new StateHandlerProcessParams<>(from, to, null);
|
final StateHandlerProcessParams<S> params = new StateHandlerProcessParams<>(from, to, null);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 一、异步逻辑校验: 首先判断是否需要异步执行状态处理器, 具体的状态逻辑处理器优先级大于全局
|
||||||
|
* 即: 如果全局指定了同步执行, 但此时特定的状态处理器注册时指定为异步执行的话. 该处理器
|
||||||
|
* 为异步执行.
|
||||||
|
*
|
||||||
|
* 二、 当确定了为异步执行时会选择合适的异步执行器(通常都是线程池), 如果状态处理器注册
|
||||||
|
* 时指定了异步执行器, 则优先使用该异步执行器;反则会使用全局的异步执行器。如果上一步骤
|
||||||
|
* 中确定为异步执行但当前步骤没有寻找到合适的异步执行器则会报空指针异常(当前版本不会出现)
|
||||||
|
*/
|
||||||
if (hw.getAsync() == null ?
|
if (hw.getAsync() == null ?
|
||||||
(context.async != null && context.async) :
|
(context.async != null && context.async) :
|
||||||
hw.getAsync()) {
|
hw.getAsync()) {
|
||||||
final Executor executor;
|
final Executor executor;
|
||||||
if ((executor = hw.getExecutor() == null ?
|
if ((executor = hw.getExecutor() == null ?
|
||||||
context.executor : hw.getExecutor()) == null)
|
context.executor : hw.getExecutor()) == null)
|
||||||
throw new NullPointerException();
|
// 不应该发生
|
||||||
|
throw new Error();
|
||||||
executor.execute(() -> stateHandler.handle(params));
|
executor.execute(() -> stateHandler.handle(params));
|
||||||
} else
|
} else
|
||||||
stateHandler.handle(params);
|
stateHandler.handle(params);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ public enum StateMachineType {
|
|||||||
* 标准, 切换使用读写锁
|
* 标准, 切换使用读写锁
|
||||||
*/
|
*/
|
||||||
STANDARD,
|
STANDARD,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 并发型, 切换使用CAS乐观锁
|
* 并发型, 切换使用CAS乐观锁
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user