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

Support Completable from a Callable #2225

Merged
merged 1 commit into from
May 23, 2022
Merged

Conversation

tkountis
Copy link
Contributor

Motivation

New Completable adapter from a Callable implementation.

Modification

New API to support this adaptor along with modification on the pre-existing fromRunnable to re-use this new Callable approach and minimize duplication.

Result

Richer API

@tkountis tkountis self-assigned this May 23, 2022
@tkountis tkountis changed the title Add Completable fromCallable Support Completable from a Callable May 23, 2022
Copy link
Contributor

@bondolo bondolo left a comment

Choose a reason for hiding this comment

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

I am curious why is Completable superior to Runnable for this use?

The use example in BlockingStreamingToStreamingService appears to show the advantage of Runnable.

}

@Override
public Completable closeAsyncGracefully() {
return blockingToCompletable(original::closeGracefully);
return Completable.fromCallable(() -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use fromRunnable here and you could continue to use a method reference?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are trying to replace the internal class here with a public one to minimize API surface and allow reusability of some utility classes without the need to open up dependencies.

@tkountis tkountis merged commit b952931 into apple:main May 23, 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