At application launch time I am making network call (resttemplate Get call) to fetch data.
Scenario is something like this,
1)Parent call which returns list of tokens(Id's)
2)Once I got list of tokens(Id's),I iterate through it make network call for each token(Id) to get Data.
What I have done so for:
1)I have used Intent service to make parent network call to get list tokens(ID's).
2)Once I got list token(Id's) I started my AsyncTask executeOnExecutor,Passing list of tokens(ID's) to asynctask through constructor and starting AsyncTask executor. Something like this,
MyAsyncExecutorTask executorTask = new MyAsyncExecutorTask(List<Integer> of tokens);
executorTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,(Void[]) null);
And In MyAsyncExecutorTask this is what I am doing.
protected Void doInBackground(Void...params) {
//Settimg max priority
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
for (int i = 0; i < scheduleList.size(); i++) {
ScheduleImpl scheduleImpl = new ScheduleImpl();
//Making network call to get data using token
scheduleImpl.getData(scheduleList(i));
}
}
Its working as it should be.
My doubts or Questions are:
1)Am I using Async executeOnExecuter() in right way(I want to make parallel network calls).I don't see any huge performance improvement after switching from AsyncTask execute() to Async executeOnExecuter().
2)How to check how many number worker threads running.