阻塞逻辑修改
This commit is contained in:
parent
1055eb3dcd
commit
06b1bea076
@ -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()
|
||||||
) {
|
) {
|
||||||
|
@ -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();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user