Removing unnecessary client-retaining code

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/32fb3e45
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/32fb3e45
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/32fb3e45

Branch: refs/heads/master
Commit: 32fb3e45fb38be858b76c5c5ac42d6892631b389
Parents: cf31d27
Author: ajs6f <aj...@virginia.edu>
Authored: Sun Oct 9 07:36:44 2016 -0400
Committer: ajs6f <aj...@virginia.edu>
Committed: Thu Oct 13 16:09:42 2016 -0400

----------------------------------------------------------------------
 .../jena/sparql/engine/http/HttpQuery.java      |  9 -------
 .../sparql/engine/http/QueryEngineHTTP.java     | 25 --------------------
 2 files changed, 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/32fb3e45/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/HttpQuery.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/HttpQuery.java 
b/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/HttpQuery.java
index c13eb69..d16e1d4 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/HttpQuery.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/HttpQuery.java
@@ -68,7 +68,6 @@ public class HttpQuery extends Params {
     private int connectTimeout = 0, readTimeout = 0;
     private boolean allowCompression = false;
     private HttpClient client;
-    private boolean requireClientShutdown = true;
 
     private HttpClientContext context;
 
@@ -207,14 +206,6 @@ public class HttpQuery extends Params {
         if (context == null) context = new HttpClientContext();
         return context;
     }
-    
-    /**
-     * Gets whether the HTTP client used should be shutdown
-     * @return True if the client should be shutdown, false otherwise
-     */
-    public boolean shouldShutdownClient() {
-        return this.requireClientShutdown;
-    }
 
     /**
      * Return whether this request will go by GET or POST

http://git-wip-us.apache.org/repos/asf/jena/blob/32fb3e45/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/QueryEngineHTTP.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/QueryEngineHTTP.java
 
b/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/QueryEngineHTTP.java
index 75d6bad..9fb7f51 100644
--- 
a/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/QueryEngineHTTP.java
+++ 
b/jena-arq/src/main/java/org/apache/jena/sparql/engine/http/QueryEngineHTTP.java
@@ -109,8 +109,6 @@ public class QueryEngineHTTP implements QueryExecution {
     // and will close when the engine is closed
     private InputStream retainedConnection = null;
 
-    private HttpClient retainedClient;
-
     public QueryEngineHTTP(String serviceURI, Query query) {
         this(serviceURI, query, query.toString());
     }
@@ -351,7 +349,6 @@ public class QueryEngineHTTP implements QueryExecution {
         }
 
         retainedConnection = in; // This will be closed on close()
-        retainedClient = httpQuery.shouldShutdownClient() ? 
httpQuery.getClient() : null;
 
         // Don't assume the endpoint actually gives back the
         // content type we asked for
@@ -671,30 +668,9 @@ public class QueryEngineHTTP implements QueryExecution {
         }
     }
 
-    @SuppressWarnings("deprecation")
     @Override
     public void close() {
         closed = true ;
-
-        // JENA-1063
-        // If we are going to shut down the HTTP client do this first as 
otherwise
-        // HTTP Client will by default try to re-use the connection and it will
-        // consume any outstanding response data in order to do this which can 
cause 
-        // the close() on the InputStream to hang for an extremely long time
-        // This also causes resources to continue to be consumed on the server 
regardless
-        // of the fact that the client has called our close() method and so 
clearly
-        // does not care about any remaining response
-        // i.e. if we don't do this we are badly behaved towards both the 
caller and 
-        // the remote server we're interacting with
-        if (retainedClient != null) {
-            try {
-                retainedClient.getConnectionManager().shutdown();
-            } catch (RuntimeException e) {
-                log.debug("Failed to shutdown HTTP client", e);
-            } finally {
-                retainedClient = null;
-            }
-        }
         
         if (retainedConnection != null) {
             try {
@@ -706,7 +682,6 @@ public class QueryEngineHTTP implements QueryExecution {
                 // warning to the logs
                 if (retainedConnection.read() != -1)
                     log.warn("HTTP response not fully consumed, if HTTP Client 
is reusing connections (its default behaviour) then it will consume the 
remaining response data which may take a long time and cause this application 
to become unresponsive");
-                
                 retainedConnection.close();
             } catch (RuntimeIOException e) {
                 // If we are closing early and the underlying stream is chunk 
encoded

Reply via email to