Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

consume responses to free up connections

  • Loading branch information...
commit 773378ca28ca9dce6e4fdc550e1937f7ba0de511 1 parent be04f9e
@notnoop authored
View
3  src/main/java/com/notnoop/mpns/internal/MpnsPooledService.java
@@ -35,6 +35,7 @@
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
+import org.apache.http.util.EntityUtils;
import com.notnoop.mpns.MpnsService;
@@ -53,7 +54,7 @@ protected void push(final HttpPost request) {
public void run() {
try {
HttpResponse response = httpClient.execute(request);
- assert response != null;
+ EntityUtils.consume(response.getEntity());
} catch (Exception e) {
throw new RuntimeException(e);
}
View
3  src/main/java/com/notnoop/mpns/internal/MpnsServiceImpl.java
@@ -36,6 +36,7 @@
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
+import org.apache.http.util.EntityUtils;
import com.notnoop.mpns.MpnsService;
import com.notnoop.mpns.exceptions.NetworkIOException;
@@ -51,7 +52,7 @@ public MpnsServiceImpl(HttpClient httpClient) {
protected void push(HttpPost request) {
try {
HttpResponse response = httpClient.execute(request);
- assert response != null;
+ EntityUtils.consume(response.getEntity());
} catch (ClientProtocolException e) {
throw new RuntimeException(e);
} catch (IOException e) {
Please sign in to comment.
Something went wrong with that request. Please try again.