slievrly commented on code in PR #6891:
URL: https://github.com/apache/incubator-seata/pull/6891#discussion_r1829256169
##########
saga/seata-saga-engine/src/main/java/org/apache/seata/saga/engine/pcext/StateMachineProcessRouter.java:
##########
@@ -105,19 +106,21 @@ public Instruction route(ProcessContext context) throws
FrameworkException {
}
public void initDefaultStateRouters() {
- if (this.stateRouters.isEmpty()) {
- TaskStateRouter taskStateRouter = new TaskStateRouter();
- this.stateRouters.put(DomainConstants.STATE_TYPE_SERVICE_TASK,
taskStateRouter);
- this.stateRouters.put(DomainConstants.STATE_TYPE_SCRIPT_TASK,
taskStateRouter);
- this.stateRouters.put(DomainConstants.STATE_TYPE_CHOICE,
taskStateRouter);
-
this.stateRouters.put(DomainConstants.STATE_TYPE_COMPENSATION_TRIGGER,
taskStateRouter);
-
this.stateRouters.put(DomainConstants.STATE_TYPE_SUB_STATE_MACHINE,
taskStateRouter);
-
this.stateRouters.put(DomainConstants.STATE_TYPE_SUB_MACHINE_COMPENSATION,
taskStateRouter);
- this.stateRouters.put(DomainConstants.STATE_TYPE_LOOP_START,
taskStateRouter);
-
- this.stateRouters.put(DomainConstants.STATE_TYPE_SUCCEED, new
EndStateRouter());
- this.stateRouters.put(DomainConstants.STATE_TYPE_FAIL, new
EndStateRouter());
+ if (!stateRouters.isEmpty()) {
+ return;
}
+
+ TaskStateRouter taskStateRouter = new TaskStateRouter();
Review Comment:
So many getValues are not very elegant, it is recommended to centralize them
in the method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]