阻塞逻辑修改

This commit is contained in:
even 2025-05-29 10:40:07 +08:00
parent 1055eb3dcd
commit 06b1bea076
2 changed files with 3 additions and 2 deletions

View File

@ -49,6 +49,7 @@ public class SerialDispatcher implements BaseDispatcher {
// TODO 监听当前taskContext状态变成执行成功或者执行失败(worker当中改变状态为运行中执行成功执行失败) // TODO 监听当前taskContext状态变成执行成功或者执行失败(worker当中改变状态为运行中执行成功执行失败)
AtomicInteger state = taskRunContext.getState(); AtomicInteger state = taskRunContext.getState();
// 如果不为正常执行成功就暂时阻塞直到有状态更改
while (state.get() != ContextStateEnum.HAPPY_ENDING.getCode() while (state.get() != ContextStateEnum.HAPPY_ENDING.getCode()
// && state.get() != ContextStateEnum.BAD_ENDING.getCode() // && state.get() != ContextStateEnum.BAD_ENDING.getCode()
) { ) {

View File

@ -71,6 +71,8 @@ public abstract class BaseRunContext {
ContextStateEnum curr = ContextStateEnum.getByCode(state.get()); ContextStateEnum curr = ContextStateEnum.getByCode(state.get());
if (ContextStateEnum.canGoto(curr,stateEnum)) { if (ContextStateEnum.canGoto(curr,stateEnum)) {
state.compareAndExchange(curr.getCode(),stateEnum.getCode()); state.compareAndExchange(curr.getCode(),stateEnum.getCode());
// 如果之前有暂停监听状态的.则停止暂停
unpause();
callParentChange(stateEnum); callParentChange(stateEnum);
} }
} }
@ -88,8 +90,6 @@ public abstract class BaseRunContext {
if (parentContext==null) { if (parentContext==null) {
return; return;
} }
// 如果之前有暂停监听状态的.则停止暂停
unpause();
if (ContextStateEnum.HAPPY_ENDING.equals(state)||ContextStateEnum.BAD_ENDING.equals(state)) { if (ContextStateEnum.HAPPY_ENDING.equals(state)||ContextStateEnum.BAD_ENDING.equals(state)) {
this.endTime=LocalDateTime.now(); this.endTime=LocalDateTime.now();
parentContext.checkChildEnd(); parentContext.checkChildEnd();