hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1638390 - in /httpcomponents/httpcore/trunk: httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
Date Tue, 11 Nov 2014 20:53:35 GMT
Author: olegk
Date: Tue Nov 11 20:53:35 2014
New Revision: 1638390

URL: http://svn.apache.org/r1638390
Log:
adding a callback to be executed when reusing an established connection from the pool

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java?rev=1638390&r1=1638389&r2=1638390&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
Tue Nov 11 20:53:35 2014
@@ -135,6 +135,12 @@ public abstract class AbstractNIOConnPoo
     protected void onRelease(final E entry) {
     }
 
+    /**
+     * @since 4.4
+     */
+    protected void onReuse(final E entry) {
+    }
+
     public boolean isShutdown() {
         return this.isShutDown.get();
     }
@@ -317,6 +323,7 @@ public abstract class AbstractNIOConnPoo
             this.available.remove(entry);
             this.leased.add(entry);
             request.completed(entry);
+            onReuse(entry);
             onLease(entry);
             return true;
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java?rev=1638390&r1=1638389&r2=1638390&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
Tue Nov 11 20:53:35 2014
@@ -113,6 +113,12 @@ public abstract class AbstractConnPool<T
     /**
      * @since 4.4
      */
+    protected void onReuse(final E entry) {
+    }
+
+    /**
+     * @since 4.4
+     */
     protected boolean validate(final E entry) {
         return true;
     }
@@ -253,6 +259,7 @@ public abstract class AbstractConnPool<T
                 if (entry != null) {
                     this.available.remove(entry);
                     this.leased.add(entry);
+                    onReuse(entry);
                     return entry;
                 }
 



Mime
View raw message