aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaphael <raphael@google.com>2011-12-08 13:39:31 -0800
committerRaphael <raphael@google.com>2011-12-08 13:39:31 -0800
commit191e6a53717c3e6fc3a9dabc2866f3818c459898 (patch)
tree1dba6af6e6bd7675ebcd0d7217f862150b6032bf
parenta62746dd6122003b6a1885c614c1f631fe7b6c60 (diff)
downloadsdk-191e6a53717c3e6fc3a9dabc2866f3818c459898.zip
sdk-191e6a53717c3e6fc3a9dabc2866f3818c459898.tar.gz
sdk-191e6a53717c3e6fc3a9dabc2866f3818c459898.tar.bz2
SDK Manager: shutdown httpclient to abort download.
When a user aborts a download in the SDK Manager, we call the HttpClient InputStream.close(). It turns out this blocks till the download is complete. Issuing the client shutdown first makes it really close the connection, as indicated in the javadoc. SDK Bug: 21167 Change-Id: Ie68a60d60f482a0f7abaea084ffbf6700a0a9a3d
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/UrlOpener.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/UrlOpener.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/UrlOpener.java
index 9a20461..3114fc0 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/UrlOpener.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/UrlOpener.java
@@ -230,10 +230,14 @@ public class UrlOpener {
return new FilterInputStream(entity.getContent()) {
@Override
public void close() throws IOException {
- super.close();
+ // Since Http Client is no longer needed, close it.
+
+ // Bug #21167: we need to tell http client to shutdown
+ // first, otherwise the super.close() would continue
+ // downloading and not return till complete.
- // since Http Client is no longer needed, close it
httpClient.getConnectionManager().shutdown();
+ super.close();
}
};
}