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

[NCL-6344] Implement Supplier interface #603

Merged
merged 1 commit into from
Mar 14, 2022

Conversation

thescouser89
Copy link
Contributor

Implement Supplier interface for BuildFinder and
DistributionAnalyzer. This is useful when invoking both of them in a
CompletableFuture.supplyAsync to produce a CompletableFuture. The
latter can then be composed and combined with other CompletableFutures.

One reason for using that composability for NCL-6344 is to implement a
cancellation feature. The flow goes from:

url -> DistributionAnalyzer -> BuildFinder

When running DistributionAnalyzer and BuildFinder as a future, it is
really impossible to stop them in case of cancellation. However, we can
cancel the rest of the flow after them.

url -> future(DistributionAnalyzer) -> check if cancelled -> future(BuildFinder)

Using a CompletableFuture makes this much easier.

Implement Supplier interface for `BuildFinder` and
`DistributionAnalyzer`. This is useful when invoking both of them in a
`CompletableFuture.supplyAsync` to produce a `CompletableFuture`. The
latter can then be composed and combined with other `CompletableFuture`s.

One reason for using that composability for NCL-6344 is to implement a
cancellation feature. The flow goes from:

url -> DistributionAnalyzer -> BuildFinder

When running `DistributionAnalyzer` and `BuildFinder` as a future, it is
really impossible to stop them in case of cancellation. However, we can
cancel the rest of the flow after them.

url -> future(DistributionAnalyzer) -> check if cancelled -> future(BuildFinder)

Using a `CompletableFuture` makes this much easier.
@pnc-bot-release
Copy link
Collaborator

Build triggered for merge commit.

@pnc-bot-release
Copy link
Collaborator

Build started for merge commit.

@thescouser89 thescouser89 merged commit be2329d into project-ncl:master Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants