-
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
New ExecutorScheduler Implementation #1219
Comments
@benjchristensen you've probably already investigated but does any of the quasar work help or the backported |
My understanding of |
@benjchristensen your right....
Not sure if that would actually solve the problem, but from my understanding, is that we always need to serially execute queued up actions on any one worker. |
That all sounds right except the "blocking until the Worker() completes" part. That would okay in Quasar, but not with native threads. It will need to behave like See observeOn here: https://github.com/Netflix/RxJava/blob/master/rxjava-core/src/main/java/rx/operators/OperatorObserveOn.java#L98 |
@benjchristensen yeah OK that makes sense. |
I guess we need to make sure executing a tasks by the same worker shouldn't hop threads, right? I see a few problems:
Bottom line is, in my opinion, that there aren't any good ways to ensure worker affinity on an Executor whose internal threads and queueing we can't control. |
As far as I am concerned, the needs I have is:
Is there a way to achieve those two goals easily without an executor? |
@samueltardieu This high jacks the issue somewhat but, the The whole point of the new Schedulers is that they execute in order which Executors are not guaranteed to do. I would use either an IO or Trampoline Scheduler for your BTLE Comms, (Also remember to Bind the |
There have been a few PRs proposing a Scheduler with fixed thread count and another with thread-caching support. The latter can be extended to put an upper limit on the active thread count if necessary. But unfortunately, these efforts are blocked on the enhancement quest to add load-balancing to the base computation scheduler and the usual concerns about API size and features to expose. I've been fiddling with an idea for some time to ask for a contrib-experimental module where all these "outcasts" and other stuff may be put. |
@akarnokd I quite like that idea, keep the main lib lean. I'm sure a contrib-concurrency would not be overkill. |
Should we rename |
I like |
@headinthebox +1 very consistent! |
As per decision at ReactiveX#1219 (comment)
I believe this is done so closing out. |
-keep class rx.internal.util.** { *; } |
It turns out a lot of people used
ExecutorScheduler
despite its problems (#711 & #713). We need to bring it back, but in a way that is compliant with the contract.This will mean that each
Worker
from theExecutorScheduler
will need to maintain it's own queue outside of theExecutor
(similar toobserveOn
) and then recurse on theExecutor
. Only a single task perWorker
can be scheduled/enqueued on anExecutor
, and when it completes then it should recurse pulling items from theWorker
queue. When the queue is empty it can stop processing. When a new task is enqueued on theWorker
then it can schedule against for execution on theExecutor
.We will be working against the default behavior of the
Executor
but need to do that to maintain the single-threaded contract of aScheduler.Worker
.The text was updated successfully, but these errors were encountered: