What happens if a HttpClient.execute() is interrupted?
I am calling HttpClient.execute() in a background thre开发者_JS百科ad. Does it throw an IOException, when I interrupt the thread?
No, at least I haven't ever seen it do so. Note that you can interrupt a download by checking Thread.currentThread().isInterrupted()
as you copy from the httpEntity.getContent()
.
There is more discussion on closing connections in other states here http://old.nabble.com/Close-interrupt-HTTP-connections-td30299655.html
精彩评论