9 ms·
Facebook using java.util.concurrent.Future<T> interface for downloading task: see here https://github.com/facebook/fresco/blob/c5e1d4cf2c081bf871f59f70cd02e4a6
by bexp 11y ago
Facebook using java.util.concurrent.Future<T> interface for downloading task: see here
https://github.com/facebook/fresco/blob/c5e1d4cf2c081bf871f59f70cd02e4a68950ac41/imagepipeline/src/main/java/com/facebook/imagepipeline/producers/HttpUrlConnectionNetworkFetcher.java https://github.com/facebook/fresco/blob/c5e1d4cf2c081bf871f5...
you can ether call future.cancel() or cancel(true):
in first case download task will be finished but further processing in pipeline will be stopped. Future.cancel(true) is more aggressive and abandons download but you will get InterruptedException. As you see from source code Facebook using less aggressive approach with future.cancel(false) call.