[Mulgara-svn] r1499 - trunk/src/jar/resolver-http/java/org/mulgara/resolver/http

pag at mulgara.org pag at mulgara.org
Sat Feb 14 06:09:49 UTC 2009


Author: pag
Date: 2009-02-13 22:09:48 -0800 (Fri, 13 Feb 2009)
New Revision: 1499

Modified:
   trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpContent.java
Log:
Correctly releasing connections, since only a SimpleConnectionManager is used, meaning that only a single connection is available.

Modified: trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpContent.java
===================================================================
--- trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpContent.java	2009-02-13 20:21:05 UTC (rev 1498)
+++ trunk/src/jar/resolver-http/java/org/mulgara/resolver/http/HttpContent.java	2009-02-14 06:09:48 UTC (rev 1499)
@@ -166,6 +166,11 @@
 
     HostConfiguration config = new HostConfiguration();
     config.setHost(host, port, Protocol.getProtocol(schema));
+    if (connection != null) {
+      connection.releaseConnection();
+      connection.close();
+      connection = null;
+    }
     try {
       connection = connectionManager.getConnectionWithTimeout(config, 0L);
     } catch (ConnectionPoolTimeoutException te) {
@@ -225,7 +230,7 @@
   private HttpMethod establishConnection(int methodType) throws IOException, NotModifiedException {
     if (logger.isDebugEnabled()) logger.debug("Establishing connection");
 
-    HttpMethod method = this.getConnectionMethod(methodType);
+    HttpMethod method = getConnectionMethod(methodType);
     Header header = null;
 
     if (method != null) {
@@ -280,7 +285,7 @@
               }
 
               // attempt a new connection to this location
-              method = this.getConnectionMethod(methodType);
+              method = getConnectionMethod(methodType);
               connection.open();
               method.execute(state, connection);
               if (!isValidStatusCode(method.getStatusCode())) {




More information about the Mulgara-svn mailing list