Need to sync I / O work in Android

In volley , I / O (get / put) operations in DiskBasedCache are synchronized, I'm not sure if this is necessary, Network streams are processing different urls, so will write to different files. If we can make sure that reading the stream won't read the files being written, is it ok to remove the sync for best performance?

+3


source to share


1 answer


Synchronization allows objects to be passed safely to different threads. Note that synchronization without contention in I / O will not be the neck of the bottle in most cases.



DiskBasedCache - Synchronization is needed here if this cache is used by multiple threads to avoid data investigation.

0


source







All Articles