Does Volley Library Handles All The Request Sequentially
Solution 1:
According to the Volley documentation
Volley maintains several network threads. If a thread is not doing anything, then it will take on a job in the queue.
To answer your question, Req1, Req2 and Req3 will each be placed in a worker thread and will run in parallel.
Volley also caches your downloaded data (and determines whether to re-download based on the expire time in the HTTP header of the downloaded data), so if your data doesn't need to be downloaded again, it's fetched from the cache, which is faster than re-downloading.
These are some of the reasons that Volley is proclaimed to be faster than standard network operations for the situations that it's appropriate to use it. You can, of course, implement this yourself, but Google has done a lot of the hard work for you.
Solution 2:
Usually a queue starts each operation according to the order it was queued, unless it's a priority queue.
Therefore, assuming equal priority (Assuming that the Volley queue is non priority queue), we can conclude that Req1
will get started first. Then Req2
, followed by Req3
.
However, we can not guarantee the order which each finishes. If Req1
is time consuming, then the requests will finish in a different order than Req1
, Req2
, Req3
.
All we can guarantee is that they will be started in the order Req1
, Req2
, Req3
.
Post a Comment for "Does Volley Library Handles All The Request Sequentially"