hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1638391 - in /httpcomponents/httpcore/branches/4.4.x: 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:56 GMT
Author: olegk
Date: Tue Nov 11 20:53:56 2014
New Revision: 1638391

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

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

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java?rev=1638391&r1=1638390&r2=1638391&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
(original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
Tue Nov 11 20:53:56 2014
@@ -195,6 +195,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();
     }
@@ -377,6 +383,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/branches/4.4.x/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java?rev=1638391&r1=1638390&r2=1638391&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
(original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/pool/AbstractConnPool.java
Tue Nov 11 20:53:56 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