Is there any way to fire an event if HttpURLConnection
has timeout before complete?
views:
78answers:
2
+2
A:
There is no built-in timeout for this. What I do is to use a different thread and interrupt the thread after the timeout.
It's easier to use FutureTask for this. See my answer to this question,
http://stackoverflow.com/questions/1247390/java-native-process-timeout/1249984#1249984
ZZ Coder
2010-05-30 13:17:39
Yes there is, see my answer.
EJP
2010-05-31 05:48:30
That's socket timeout, only fires when you have network problem.
ZZ Coder
2010-05-31 14:18:52
+1
A:
URLConnection.setConnectTimeout() URLConnection.setReadTimeout()
@since 1.5
EJP
2010-05-31 05:48:11