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

Callback tryOnSuccess/tryOnFailure #971

Merged
merged 21 commits into from Aug 8, 2019

Conversation

@alexandru
Copy link
Member

commented Aug 2, 2019

This is a continuation of #917.

Thread-safe implementations of Callback (that protect the Callback's contract) are supposed to throw CallbackCalledMultipleTimesException in case the result was signaled more than once.

The callbacks returned the Callback.safe, Callback.trampoline and Callback.forked wrappers are now all thread-safe. The callback injected in Task.create (and variants) is thread-safe as well.

Also added 2 methods on Callback: tryOnSuccess and tryOnFailure. These forward by default the call to onSuccess and onError. If these throw, then the exception gets caught in the try* versions.

alexandru added 13 commits Aug 1, 2019
@Avasil
Avasil approved these changes Aug 3, 2019
alexandru added 7 commits Aug 3, 2019
@alexandru

This comment has been minimized.

Copy link
Member Author

commented Aug 3, 2019

This one is ready for merging.

I added tests and changed the behavior of the Task.async builders to also report errors, thrown in the registration function, via the callback. We couldn't do that before because the callback wasn't safe.

@Avasil

This comment has been minimized.

Copy link
Collaborator

commented Aug 3, 2019

Thanks @alexandru , we'll get it in for the release

@Avasil Avasil added this to the 3.0.0 milestone Aug 6, 2019

@Avasil

This comment has been minimized.

Copy link
Collaborator

commented Aug 8, 2019

I'm merging it @oleg-py but if you have any objections/suggestions we can patch it in next PR

@Avasil Avasil merged commit ada76d5 into monix:master Aug 8, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.