Reputation: 2570
I have a system consists of workers that crawl web pages. Now, I set two parameters of URLConnection: connectTimeout and readTimeout.
As inferred, the app is multithreaded.
Questions:
Is there a better solution?
Upvotes: 0
Views: 57
Reputation: 7790
Simply put, unless you use the number of threads in the 100s then chances are you don't have to worry about starvation. The time that a thread loses due to context switching is really negligible. (Remember your computer most likely has several processors and also IO may be processed IO processing component and not a processor). So in most cases your 10 seconds timeout is really a 10 seconds timeout.
Upvotes: 1