From 2dbe8c3557ae0e8e43338a713ee74b3ee3e24f35 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Sun, 1 Jul 2007 10:57:13 +0000 Subject: [PATCH] Some more tweaks git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@552278 13f79535-47bb-0310-9956-ffa450edef68 --- .../http/examples/client/ClientConnectionRelease.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/module-client/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java b/module-client/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java index be4cf6ecb..e9a5687de 100644 --- a/module-client/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java +++ b/module-client/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java @@ -71,14 +71,12 @@ public class ClientConnectionRelease { // If the response does not enclose an entity, there is no need // to bother about connection release if (entity != null) { - // do something useful with the response BufferedReader reader = new BufferedReader( new InputStreamReader(entity.getContent())); try { + // do something useful with the response System.out.println(reader.readLine()); - // In case of an IOException the connection will be released - // back to the connection manager automatically } catch (IOException ex) { @@ -99,8 +97,9 @@ public class ClientConnectionRelease { // Closing the input stream will trigger connection release reader.close(); // Alternatively you may want to call this method when done - // with the response entity. It will also trigger connection - // release + // with the response entity to ensure the response content has + // been fully consumed. This will also trigger connection + // release entity.consumeContent(); }