hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rola...@apache.org
Subject svn commit: r607421 - in /httpcomponents/httpclient/trunk: RELEASE_NOTES.txt module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
Date Sat, 29 Dec 2007 14:40:44 GMT
Author: rolandw
Date: Sat Dec 29 06:40:44 2007
New Revision: 607421

URL: http://svn.apache.org/viewvc?rev=607421&view=rev
Log:
HTTPCLIENT-677: no Thread.interrupt() for shutdown

Modified:
    httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java

Modified: httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt?rev=607421&r1=607420&r2=607421&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/trunk/RELEASE_NOTES.txt Sat Dec 29 06:40:44 2007
@@ -1,8 +1,7 @@
 Changes since 4.0 Alpha 2
 -------------------
 
-* [HTTPCLIENT-677] Thread safe client connection manager no longer uses
-  Thread.interrupt() when a connection becomes available.
+* [HTTPCLIENT-677] Connection manager no longer uses Thread.interrupt()
   Contributed by Roland Weber <rolandw at apache.org>
 
 * [HTTPCLIENT-716] Allow application-defined routes.

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java?rev=607421&r1=607420&r2=607421&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
Sat Dec 29 06:40:44 2007
@@ -239,27 +239,20 @@
 
                         rospl.queueThread(waitingThread);
                         waitingThreads.add(waitingThread);
-                        success = waitingThread.await(timeToWait); //@@@, TimeUnit.MILLISECONDS);
-                        //@@@ The 'success' flag is somewhat different from the
-                        //@@@ previous technique using interrupts. If the CM is
-                        //@@@ shutting down, we now get an InterruptedException
-                        //@@@ and have no check for that special case. What we
-                        //@@@ want to do is to let the exception fly through.
-                        //@@@ Actually, we may want to have a special exception
-                        //@@@ for the shutdown case, but that is goldplating.
-
+                        success = waitingThread.await(timeToWait); //@@@, TimeUnit.MILLISECONDS);
or deadline
                     } finally {
                         if (!success) {
                             // Either we timed out, experienced a
-                            // "spurious wakeup", or were interrupted by an
-                            // external thread.  Regardless we need to 
+                            // "spurious wakeup", or were interrupted by
+                            // an external thread. Regardless, we need to 
                             // cleanup for ourselves in the wait queue.
                             rospl.removeThread(waitingThread);
                             waitingThreads.remove(waitingThread);
                         }
                         // In case of 'success', we were woken up by the
                         // connection pool and should now have a connection
-                        // waiting for us. Continue in the loop and get it.
+                        // waiting for us, or else we're shutting down.
+                        // Just continue in the loop, both cases are checked.
 
                         if (useTimeout) {
                             endWait = System.currentTimeMillis();
@@ -571,12 +564,12 @@
                 closeConnection(entry.getConnection());
             }
 
-            // interrupt all waiting threads
+            // wake up all waiting threads
             Iterator<WaitingThread> iwth = waitingThreads.iterator();
             while (iwth.hasNext()) {
                 WaitingThread waiter = iwth.next();
                 iwth.remove();
-                waiter.getThread().interrupt();
+                waiter.wakeup();
             }
 
             routeToPool.clear();



Mime
View raw message