-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Allow registering a custom Predicate
for determining non-blocking threads
#3854
Allow registering a custom Predicate
for determining non-blocking threads
#3854
Conversation
…hreads Related issue: reactor#3833 Motivation: It is currently not possible to create a non-blocking threads without implementing the `reactor.core.scheduler.NonBlocking` interface. Some third-party libraries and frameworks don't directly depend on `reactor-core`, yet they want to mark the threads they manage as non-blocking. Modifications: - Added a new method `Schedulers.registerNonBlockingThreadPredicate()` so that a user can register their own `Predicate` that determines whether a given thread is non-blocking or not - Also added `Schedulers.resetNonBlockingThreadPredicate()` so that a user can unregister all previous `Predicate`s - Fixed an incorrectly implemented test that doesn't really test anything: - `SchedulersTest.isInNonBlockingThreadTrue()` Result: - Closes reactor#3833 - A user can now mark their own `Thread` classes as non-blocking without depending on `reactor-core` or implementing the `NonBlocking` marker interface.
Please run |
@chemicL It looks like 3.6.x doesn't have Spotless. I can update the license headers of the modified files, but could you point me to the right license header? |
By the way, I ran
Environment:
|
I'm not sure what's up with your local setup, but there's nothing fishy on our side I think. I will commit my updates and we can merge. Here's what I did:
And running
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution! It's an honour, @trustin :)
Related issue: #3833
Motivation:
It is currently not possible to create a non-blocking threads without implementing the
reactor.core.scheduler.NonBlocking
interface. Some third-party libraries and frameworks don't directly depend onreactor-core
, yet they want to mark the threads they manage as non-blocking.Modifications:
Schedulers.registerNonBlockingThreadPredicate()
so that a user can register their ownPredicate
that determines whether a given thread is non-blocking or notSchedulers.resetNonBlockingThreadPredicate()
so that a user can unregister all previousPredicate
sSchedulersTest.isInNonBlockingThreadTrue()
Result:
Thread
classes as non-blocking without depending onreactor-core
or implementing theNonBlocking
marker interface.