hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1164938 - in /httpcomponents/httpcore/trunk: httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/ httpcore/src/main/java/org/apache/http/impl/pool/ httpcore/src/test/java/org/apache/http/impl/pool/
Date Sat, 03 Sep 2011 21:53:38 GMT
Author: olegk
Date: Sat Sep  3 21:53:37 2011
New Revision: 1164938

URL: http://svn.apache.org/viewvc?rev=1164938&view=rev
Log:
Use generic pool entry in basic pool implementations

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnPool.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/pool/TestBasicConnPool.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java?rev=1164938&r1=1164937&r2=1164938&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/pool/BasicNIOConnPool.java
Sat Sep  3 21:53:37 2011
@@ -42,6 +42,7 @@ import org.apache.http.nio.pool.NIOConnF
 import org.apache.http.nio.reactor.ConnectingIOReactor;
 import org.apache.http.params.HttpConnectionParams;
 import org.apache.http.params.HttpParams;
+import org.apache.http.pool.PoolEntry;
 
 /**
  * Basic non-blocking {@link NHttpClientConnection} pool.
@@ -60,7 +61,8 @@ import org.apache.http.params.HttpParams
  * @since 4.2
  */
 @ThreadSafe
-public class BasicNIOConnPool extends AbstractNIOConnPool<HttpHost, NHttpClientConnection,
BasicNIOPoolEntry> {
+public class BasicNIOConnPool extends AbstractNIOConnPool<HttpHost, NHttpClientConnection,
+                                            PoolEntry<HttpHost, NHttpClientConnection>>
{
 
     private static AtomicLong COUNTER = new AtomicLong();
 
@@ -98,7 +100,7 @@ public class BasicNIOConnPool extends Ab
     }
 
     @Override
-    protected void closeEntry(final BasicNIOPoolEntry entry) {
+    protected void closeEntry(final PoolEntry<HttpHost, NHttpClientConnection> entry)
{
         NHttpClientConnection conn = entry.getConnection();
         try {
             conn.shutdown();
@@ -107,16 +109,18 @@ public class BasicNIOConnPool extends Ab
     }
 
     @Override
-    public Future<BasicNIOPoolEntry> lease(
+    public Future<PoolEntry<HttpHost, NHttpClientConnection>> lease(
             final HttpHost route,
             final Object state,
-            final FutureCallback<BasicNIOPoolEntry> callback) {
+            final FutureCallback<PoolEntry<HttpHost, NHttpClientConnection>>
callback) {
         int connectTimeout = HttpConnectionParams.getConnectionTimeout(this.params);
         return super.lease(route, state, connectTimeout, TimeUnit.MILLISECONDS, callback);
     }
 
     @Override
-    public Future<BasicNIOPoolEntry> lease(final HttpHost route, final Object state)
{
+    public Future<PoolEntry<HttpHost, NHttpClientConnection>> lease(
+            final HttpHost route,
+            final Object state) {
         int connectTimeout = HttpConnectionParams.getConnectionTimeout(this.params);
         return super.lease(route, state, connectTimeout, TimeUnit.MILLISECONDS, null);
     }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnPool.java?rev=1164938&r1=1164937&r2=1164938&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/pool/BasicConnPool.java
Sat Sep  3 21:53:37 2011
@@ -36,12 +36,14 @@ import org.apache.http.annotation.Thread
 import org.apache.http.params.HttpParams;
 import org.apache.http.pool.AbstractConnPool;
 import org.apache.http.pool.ConnFactory;
+import org.apache.http.pool.PoolEntry;
 
 /**
  * @since 4.2
  */
 @ThreadSafe
-public class BasicConnPool extends AbstractConnPool<HttpHost, HttpClientConnection, BasicPoolEntry>
{
+public class BasicConnPool extends AbstractConnPool<HttpHost, HttpClientConnection,
+                                                    PoolEntry<HttpHost, HttpClientConnection>>
{
 
     private static AtomicLong COUNTER = new AtomicLong();
 
@@ -54,12 +56,14 @@ public class BasicConnPool extends Abstr
     }
 
     @Override
-    protected BasicPoolEntry createEntry(final HttpHost host, final HttpClientConnection
conn) {
+    protected PoolEntry<HttpHost, HttpClientConnection> createEntry(
+            final HttpHost host,
+            final HttpClientConnection conn) {
         return new BasicPoolEntry(Long.toString(COUNTER.getAndIncrement()), host, conn);
     }
 
     @Override
-    protected void closeEntry(final BasicPoolEntry entry) {
+    protected void closeEntry(final PoolEntry<HttpHost, HttpClientConnection> entry)
{
         HttpConnection conn = entry.getConnection();
         try {
             conn.close();

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/pool/TestBasicConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/pool/TestBasicConnPool.java?rev=1164938&r1=1164937&r2=1164938&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/pool/TestBasicConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/pool/TestBasicConnPool.java
Sat Sep  3 21:53:37 2011
@@ -39,6 +39,7 @@ import org.apache.http.HttpHost;
 import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.CoreConnectionPNames;
 import org.apache.http.params.HttpParams;
+import org.apache.http.pool.PoolEntry;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -117,7 +118,7 @@ public class TestBasicConnPool {
         host = new HttpHost("localhost", serverPort, "http");
         conn = connFactory.create(host);
 
-        BasicPoolEntry entry = pool.createEntry(host, conn);
+        PoolEntry<HttpHost, HttpClientConnection> entry = pool.createEntry(host, conn);
 
         assertEquals(conn, entry.getConnection());
         assertEquals("localhost", entry.getRoute().getHostName());



Mime
View raw message