You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@oozie.apache.org by "Hadoop QA (JIRA)" <ji...@apache.org> on 2019/05/10 08:41:00 UTC
[jira] [Commented] (OOZIE-3486) duplicate code in
ControlNodeHandler
[ https://issues.apache.org/jira/browse/OOZIE-3486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16837028#comment-16837028 ]
Hadoop QA commented on OOZIE-3486:
----------------------------------
PreCommit-OOZIE-Build started
> duplicate code in ControlNodeHandler
> ------------------------------------
>
> Key: OOZIE-3486
> URL: https://issues.apache.org/jira/browse/OOZIE-3486
> Project: Oozie
> Issue Type: Improvement
> Affects Versions: trunk
> Reporter: Andras Salamon
> Assignee: Andras Salamon
> Priority: Minor
> Attachments: OOZIE-3486-01.patch
>
>
> There are duplicate code blocks in ControlNodeHandler and JoinNodeDef classes.
> section of the {{enter}} method of {{ControlNodeHandler:}}
> {noformat}
> ...
> else if (nodeClass.equals(JoinNodeDef.class)) {
> String parentExecutionPath = context.getParentExecutionPath(context.getExecutionPath());
> String forkCount = context.getVar(FORK_COUNT_PREFIX + parentExecutionPath);
> if (forkCount == null) {
> throw new WorkflowException(ErrorCode.E0720, context.getNodeDef().getName());
> }
> int count = Integer.parseInt(forkCount) - 1;
> if (count > 0) {
> context.setVar(FORK_COUNT_PREFIX + parentExecutionPath, "" + count);
> context.deleteExecutionPath();
> }
> else {
> context.setVar(FORK_COUNT_PREFIX + parentExecutionPath, null);
> }
> LOG.debug("count = " + count + " for parent execution path " + parentExecutionPath);
> doTouch = (count == 0);
> }
> ....{noformat}
> {{enter}} method of {{JoinNodeDef}}:
> {noformat}
> public boolean enter(Context context) throws WorkflowException {
> String parentExecutionPath = context.getParentExecutionPath(context.getExecutionPath());
> String forkCount = context.getVar(ControlNodeHandler.FORK_COUNT_PREFIX + parentExecutionPath);
> if (forkCount == null) {
> throw new WorkflowException(ErrorCode.E0720, context.getNodeDef().getName());
> }
> int count = Integer.parseInt(forkCount) - 1;
> if (count > 0) {
> context.setVar(ControlNodeHandler.FORK_COUNT_PREFIX + parentExecutionPath, "" + count);
> context.deleteExecutionPath();
> }
> else {
> context.setVar(ControlNodeHandler.FORK_COUNT_PREFIX + parentExecutionPath, null);
> }
> return (count == 0);
> }
> {noformat}
> Similarly one section of {{loopDetection}} can be found in {{JoinNodeDef}}, one section of {{multiExit}} can be found in {{ForkNodeDef}}.
> We should eliminate the code duplication.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)