Android-CleanArchitecture
Android-CleanArchitecture copied to clipboard
Cloud and Disk logic executed on Main Thread
Not sure if its on purpose but the way you made rxjava with subscribeOn and observeOn doesn't put UserDataStore logic on background Thread. You have to Defer logic to background Thread.
You can check it in this thread. http://stackoverflow.com/questions/29169194/why-does-subscribe-not-executed-in-a-new-thread
in that SO post, the method is not returning an Observable. However, buildUseCaseObservable method from UseCase class is returning Observable. So, it will execute on background Thread (in this case Schedulers.IO).
@aldoKelvianto but when print enable Strict mode I am getting warning
StrictMode policy violation; ~duration=58 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=65543 violation=2
And I did the print the name of the thread:
Log.d("TAG", "Current Thread Name : " + Thread.currentThread().getName());
I am getting "main"
That means disk reading from the main thread.