hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1174627 - in /httpcomponents/httpclient/trunk: ./ httpclient/src/main/java/org/apache/http/impl/conn/
Date Fri, 23 Sep 2011 09:53:42 GMT
Author: olegk
Date: Fri Sep 23 09:53:42 2011
New Revision: 1174627

URL: http://svn.apache.org/viewvc?rev=1174627&view=rev
Log:
Upgraded HttpCore to version 4.2-alpha2

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/HttpConnPool.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/HttpPoolEntry.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/PoolingClientConnectionManager.java
    httpcomponents/httpclient/trunk/pom.xml

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/HttpConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/HttpConnPool.java?rev=1174627&r1=1174626&r2=1174627&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/HttpConnPool.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/HttpConnPool.java
Fri Sep 23 09:53:42 2011
@@ -31,10 +31,10 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.commons.logging.Log;
-import org.apache.http.HttpConnection;
 import org.apache.http.conn.OperatedClientConnection;
 import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.pool.AbstractConnPool;
+import org.apache.http.pool.ConnFactory;
 
 /**
  * @since 4.2
@@ -50,33 +50,24 @@ class HttpConnPool extends AbstractConnP
     public HttpConnPool(final Log log,
             final int defaultMaxPerRoute, final int maxTotal,
             final long timeToLive, final TimeUnit tunit) {
-        super(defaultMaxPerRoute, maxTotal);
+        super(new InternalConnFactory(), defaultMaxPerRoute, maxTotal);
         this.log = log;
         this.timeToLive = timeToLive;
         this.tunit = tunit;
     }
 
     @Override
-    protected OperatedClientConnection createConnection(final HttpRoute route) throws IOException
{
-        return new DefaultClientConnection();
-    }
-
-    @Override
     protected HttpPoolEntry createEntry(final HttpRoute route, final OperatedClientConnection
conn) {
         String id = Long.toString(COUNTER.getAndIncrement());
         return new HttpPoolEntry(this.log, id, route, conn, this.timeToLive, this.tunit);
     }
 
-    @Override
-    protected void closeEntry(final HttpPoolEntry entry) {
-        HttpConnection conn = entry.getConnection();
-        try {
-            conn.shutdown();
-        } catch (IOException ex) {
-            if (this.log.isDebugEnabled()) {
-                this.log.debug("I/O error shutting down connection", ex);
-            }
+    static class InternalConnFactory implements ConnFactory<HttpRoute, OperatedClientConnection>
{
+
+        public OperatedClientConnection create(final HttpRoute route) throws IOException
{
+            return new DefaultClientConnection();
         }
+
     }
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/HttpPoolEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/HttpPoolEntry.java?rev=1174627&r1=1174626&r2=1174627&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/HttpPoolEntry.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/HttpPoolEntry.java
Fri Sep 23 09:53:42 2011
@@ -26,6 +26,7 @@
  */
 package org.apache.http.impl.conn;
 
+import java.io.IOException;
 import java.util.Date;
 import java.util.concurrent.TimeUnit;
 
@@ -75,4 +76,20 @@ class HttpPoolEntry extends PoolEntry<Ht
         return this.tracker.toRoute();
     }
 
+    @Override
+    public boolean isClosed() {
+        OperatedClientConnection conn = getConnection();
+        return !conn.isOpen();
+    }
+
+    @Override
+    public void close() {
+        OperatedClientConnection conn = getConnection();
+        try {
+            conn.close();
+        } catch (IOException ex) {
+            this.log.debug("I/O error closing connection", ex);
+        }
+    }
+
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/PoolingClientConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/PoolingClientConnectionManager.java?rev=1174627&r1=1174626&r2=1174627&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/PoolingClientConnectionManager.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/PoolingClientConnectionManager.java
Fri Sep 23 09:53:42 2011
@@ -310,14 +310,26 @@ public class PoolingClientConnectionMana
         this.pool.closeExpired();
     }
 
+    public int getMaxTotal() {
+        return this.pool.getMaxTotal();
+    }
+
     public void setMaxTotal(int max) {
         this.pool.setMaxTotal(max);
     }
 
+    public int getDefaultMaxPerRoute() {
+        return this.pool.getDefaultMaxPerRoute();
+    }
+
     public void setDefaultMaxPerRoute(int max) {
         this.pool.setDefaultMaxPerRoute(max);
     }
 
+    public int getMaxPerRoute(final HttpRoute route) {
+        return this.pool.getMaxPerRoute(route);
+    }
+
     public void setMaxPerRoute(final HttpRoute route, int max) {
         this.pool.setMaxPerRoute(route, max);
     }

Modified: httpcomponents/httpclient/trunk/pom.xml
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/pom.xml?rev=1174627&r1=1174626&r2=1174627&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/pom.xml (original)
+++ httpcomponents/httpclient/trunk/pom.xml Fri Sep 23 09:53:42 2011
@@ -67,7 +67,7 @@
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-    <httpcore.version>4.2-alpha1</httpcore.version>
+    <httpcore.version>4.2-alpha2</httpcore.version>
     <commons-logging.version>1.1.1</commons-logging.version>
     <commons-codec.version>1.4</commons-codec.version>
     <ehcache.version>2.2.0</ehcache.version>



Mime
View raw message