android10 / android10/Android-CleanArchitecture
Use of Schedulers on UseCase
- Lingua principale
- Java
- Stelle
- 15.5k
- Fork
- 3.3k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Hi,
I was reading your project and there's something regarding the use of Schedulers on UseCase that I don't well understand.
Note that I'm quite new to android programming so please forgive me if I say something terribly wrong! 😅
So, why the UseCase needs a ThreadExecutor for the "backend" computation and a Scheduler to execute the observer? Why not ask for the same type?
I mean, if the reason to ask for a ThreadExecutor is to be free to use whatever executor you want, why the same thing doesn't apply for `observeOn`? Why can't we ask again for another ThreadExecutor and simply call `observeOn(Schedulers.from(executor))`?
(Note: I understand that is very simple to refer to the main thread using Schedulers thanks to `AndroidSchedulers.mainThread()`. There isn't a so simple way to obtain the main ThreadExecutor on Android?)
And why we can't achieve the same result asking for two Schedulers?
I mean, if I want simply use Schedulers.io() as background scheduler, how can I pass it to the UseCase?
If the UseCase was asking for a Scheduler also for `subscribeOn`, I could pass Schedulers.io() or a custom scheduler (created with `Scheduler.from(myThreadExecutor)`) based on my need.
Thanks in advance!
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Nell’issue non viene identificato alcun file o test. Inizia individuando l’implementazione di UseCase e il suo utilizzo di ThreadExecutor, subscribeOn, observeOn e Scheduler; il lavoro sarebbe completato con una spiegazione concordata o una modifica alla documentazione che chiarisca perché queste astrazioni differiscono e come fornire scheduler personalizzati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- android, java
- Ambito
- mobile-dev
- Tipo di issue
- Documentazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 20/100