abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r442106 - in /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client: Client.java CommonsClient.java
Date Mon, 11 Sep 2006 05:37:01 GMT
Author: jmsnell
Date: Sun Sep 10 22:37:01 2006
New Revision: 442106

URL: http://svn.apache.org/viewvc?view=rev&rev=442106
Log:
The Commons client documentation recommends explicitly tearing down the multithreaded
connection manager when we're all done with it.

Modified:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/Client.java
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsClient.java

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/Client.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/Client.java?view=diff&rev=442106&r1=442105&r2=442106
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/Client.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/Client.java
Sun Sep 10 22:37:01 2006
@@ -274,4 +274,10 @@
           "https", 
           (ProtocolSocketFactory)factory, port));
   }
+  
+  /**
+   * Explicitly tear down the Client instance
+   */
+  public void teardown() {}
+  
 }

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsClient.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsClient.java?view=diff&rev=442106&r1=442105&r2=442106
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsClient.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/CommonsClient.java
Sun Sep 10 22:37:01 2006
@@ -166,4 +166,21 @@
       AuthPolicy.AUTH_SCHEME_PRIORITY, 
       authPrefs);
   }
+  
+  /**
+   * <p>Per http://jakarta.apache.org/commons/httpclient/performance.html</p>
+   * <blockquote>
+   *   Generally it is recommended to have a single instance of HttpClient 
+   *   per communication component or even per application. However, if the 
+   *   application makes use of HttpClient only very infrequently, and keeping 
+   *   an idle instance of HttpClient in memory is not warranted, it is highly 
+   *   recommended to explicitly  shut down the multithreaded connection manager 
+   *   prior to disposing the HttpClient instance. This will ensure proper 
+   *   closure of all HTTP connections in the connection pool.
+   * </blockquote>
+   */
+  public void teardown() {
+    ((MultiThreadedHttpConnectionManager)
+      client.getHttpConnectionManager()).shutdown();
+  }
 }



Mime
View raw message