开发者

Connection timeout in java?

Is 开发者_如何学Pythonthere any way to fire an event if HttpURLConnection has timeout before complete?


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,

java native Process timeout


URLConnection.setConnectTimeout()
URLConnection.setReadTimeout()

@since 1.5

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜