-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
3.x Feature: introduce abstract time source for scheduler impl #7154
Comments
You can override |
@akarnokd , I actually do not want to implement/ delegate, because this will probably only work 'new' scheduler. What about For example, when I use Regarding delegation and overriding: Yes I could just wrap another Scheduler and overwrite now for Performance wise I would reckon, that C2/ ART would just inline the call to the time-source, if Do you have a better idea how to easily switch the time without requiring to re-implement schedulers (e.g. reuse |
Another idea would be to use the Java standard Otherwise, yes, we would need to add indirection to the |
Is this a bad idea to add a method to RxJavaPlugins to override the default time source?
@SergejIsbrecht RxJavaPlugins can also be used to override single, io and computational schedulers. This doesn't cover Schedulers.from(), but at least it covers computation(). |
I generally prefer to modify RxJavaPlugins as a last resort. |
Dear @akarnokd, I have been looking into Scheduler
Worker
Example implementation of
Condition
Problem: Conclusion: Regarding you suggestion:
I do see a problem with this approach:
Conclusion: Resolution:
I would probably not do it. There might be a use-case, there you want to configure how each SchedulerWrapper-Impl: |
ObservableInterval uses
I have to think about this. |
This is probably more of a isosteric problen, than a real one. Our developers probably use every method in the
For example when I use a Example
|
I see. For a start, would the introduction of a system property |
Yes, of course. This would be enough for me. I would probably call it Edit: if this is the way, I would like to suggest, that I backport this change back to RxJava2, because we are currently using it and we would not need to change, before RxJava2 reaches EOL on If you would like, I would create an PR for RxJava3 and RxJava3, adding said property. |
Sure, go ahead. Let's use |
Issue-Id: #7154 Co-authored-by: Sergej Isbrecht <[email protected]>
Co-authored-by: Sergej Isbrecht <[email protected]>
Version:
rxjava:3.0.9
Related:
#2943
Precondition:
Scheduler
Problem:
When the linux kernel wakes up from suspension
System.currentTimeMillis
will be adjusted on linux x86 OpenJDK. In my case this is bad, because watchdogs/ timer will fire, which they shouldn't. I would like to use a different time-source, but can't, becauseSystem.currentTimeMillis
is hard-coded.Solution:
I would like to introduce a
TimeSource
interface, which can be set viaRxJavaPlugins
.Impl
In order to not break the current behavior the default TimeSource would still be
System.currentTimeMillis()
.This idea was pitched by: @artem-zinnatullin in #2943 (comment)
If this is fine request is fine with the community I would try to implement it quickly and create a PR for it.
The text was updated successfully, but these errors were encountered: