From 2e73e083ed837b1fd17548cbcd27bd321d0a3b8b Mon Sep 17 00:00:00 2001 From: andrey-qlogic Date: Fri, 30 Nov 2018 12:29:04 +0000 Subject: [PATCH] 4107: Disconnect response after request --- .../com/google/cloud/storage/spi/v1/HttpStorageRpc.java | 7 ++++++- google-cloud-clients/pom.xml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java b/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java index 19c9324518d7..5653e6a42d4b 100644 --- a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java +++ b/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java @@ -681,14 +681,19 @@ public void write(String uploadId, byte[] toWrite, int toWriteOffset, long destO int code; String message; IOException exception = null; + HttpResponse response = null; try { - HttpResponse response = httpRequest.execute(); + response = httpRequest.execute(); code = response.getStatusCode(); message = response.getStatusMessage(); } catch (HttpResponseException ex) { exception = ex; code = ex.getStatusCode(); message = ex.getStatusMessage(); + } finally { + if (response != null ) { + response.disconnect(); + } } if (!last && code != 308 || last && !(code == 200 || code == 201)) { if (exception != null) { diff --git a/google-cloud-clients/pom.xml b/google-cloud-clients/pom.xml index 1030080295e9..5dfcd0558577 100644 --- a/google-cloud-clients/pom.xml +++ b/google-cloud-clients/pom.xml @@ -155,7 +155,7 @@ github google-cloud-clients 0.72.0-alpha - 1.27.0 + 1.27.1-SNAPSHOT 1.35.0 0.12.0 1.16.1