How to deal with a bunch of sinchronic requests in Retrofit 2?

Try realizovati database synchronization:
-first load elements of the first level, then as you load each item in the first level, podrugoy the elements of the second and so on to infinity can run queries. How to put it all in a queue so that the application does not fall? Fished off the website, Chet empty (or I don't go right to look) Also tried here to watch - with no results.
July 8th 19 at 11:18
2 answers
July 8th 19 at 11:20
Do not use in Retrofit activity
Thanks, I'll try - winnifred_Kreiger commented on July 8th 19 at 11:23
July 8th 19 at 11:22
Use An ExecutorService

public class MyService extends Service {

 final String LOG_TAG = "myLogs";
 ExecutorService es;

 public void onCreate() {
super.onCreate();
 Log.d(LOG_TAG, "onCreate MyService");
 es = Executors.newFixedThreadPool(2);
}
...
}


Where 2 is the number of available threads.

See example on Startandroid

Find more questions by tags Android