Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WFCORE-7077 SuspendController relies on blocking ServiceActivity behaviour for ordering #6267

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

pferraro
Copy link
Contributor

@pferraro pferraro marked this pull request as ready for review November 30, 2024 16:03
}
}
}
}
};
groupCompleter.accept(null, null);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since groupCompleter.accept is being invoked here, wouldn't it be clearer if we get the rid of this BiConsumer and just transform it on a method that is directly invoked?

I mean, put everything inside groupCompleter.accept in its own method and avoid the usage of the BiConsumer

Copy link
Collaborator

@yersan yersan Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I tried simplifying it since it looks complex. I was just thinking whether it would be possible to split it into clearer chunks, my understanding is we are processing groups, and per each group, the activities in that group, so I was trying to at least get it split into those two methods to try to see it more clear, but it does not look simple.

If it is not possible, I have no complaints moving on with it, although looks complex and difficult to understand, at least to me :)

Copy link
Contributor Author

@pferraro pferraro Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since groupCompleter.accept is being invoked here, wouldn't it be clearer if we get the rid of this BiConsumer and just transform it on a method that is directly invoked?

This BiConsumer is used as the completion handler per group.

groupStage.whenComplete(this);

Rather than creating a new completion handler instance per group, each group shares the same instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect that this looks complex because it uses recursion (i.e. the completion handler of each group stage registers itself as the completion handler of the next group stage).
I can replace this with a more verbose iterative implementation if that would be more intuitive.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pferraro feel free to ignore the above, now I got the issue and the resolution, in the old code we were moving to the next group even if the list of activities of the previous group has not been completed yet. Now this is fixed since the next group is not processed until all the activities have been completed.

}
}
}
}
};
groupCompleter.accept(null, null);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pferraro feel free to ignore the above, now I got the issue and the resolution, in the old code we were moving to the next group even if the list of activities of the previous group has not been completed yet. Now this is fixed since the next group is not processed until all the activities have been completed.

groupStage.complete(null);
} else {
// Counter used to determine when to complete group stage
AtomicInteger groupCounter = new AtomicInteger(activities.size());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: This should be named activityCounter instead groupCounter due to what it represents.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me fix that - surely that's a potential source of confusion.

@yersan yersan added the ready-for-merge This PR is ready to be merged and fulfills all requirements label Dec 3, 2024
@yersan yersan merged commit 7a5b3e3 into wildfly:main Dec 3, 2024
2 of 10 checks passed
@yersan
Copy link
Collaborator

yersan commented Dec 3, 2024

Thanks @pferraro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge This PR is ready to be merged and fulfills all requirements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants