HTTPCLIENT-692: TSCCM throws InterruptedException

git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@578385 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Roland Weber 2007-09-22 07:22:57 +00:00
parent 5d5b2fa48d
commit a9722d704e
4 changed files with 16 additions and 12 deletions

View File

@ -1,5 +1,8 @@
Changes since release 4.0 Alpha 1
* [HTTPCLIENT-692] ClientConnectionManager throws InterruptedException
Contributed by Roland Weber <rolandw at apache.org>
* [HTTPCORE-116] moved parameter names to interfaces
Contributed by Roland Weber <rolandw at apache.org>

View File

@ -156,11 +156,13 @@ protected AbstractConnPool(ClientConnectionManager mgr) {
*
* @throws ConnectionPoolTimeoutException
* if the timeout expired
* @throws InterruptedException
* if the calling thread was interrupted
*/
public abstract
BasicPoolEntry getEntry(HttpRoute route, long timeout,
ClientConnectionOperator operator)
throws ConnectionPoolTimeoutException
throws ConnectionPoolTimeoutException, InterruptedException
;

View File

@ -167,7 +167,7 @@ public synchronized int getConnectionsInPool(HttpRoute route) {
public synchronized
BasicPoolEntry getEntry(HttpRoute route, long timeout,
ClientConnectionOperator operator)
throws ConnectionPoolTimeoutException {
throws ConnectionPoolTimeoutException, InterruptedException {
BasicPoolEntry entry = null;
@ -245,8 +245,7 @@ BasicPoolEntry getEntry(HttpRoute route, long timeout,
} catch (InterruptedException e) {
if (!waitingThread.interruptedByConnectionPool) {
LOG.debug("Interrupted while waiting for connection.", e);
throw new IllegalThreadStateException(
"Interrupted while waiting in " + this);
throw e;
}
// Else, do nothing, we were interrupted by the
// connection pool and should now have a connection

View File

@ -141,19 +141,19 @@ public SchemeRegistry getSchemeRegistry() {
// non-javadoc, see interface ClientConnectionManager
public ManagedClientConnection getConnection(HttpRoute route) {
public ManagedClientConnection getConnection(HttpRoute route)
throws InterruptedException {
while (true) {
try {
return getConnection(route, 0);
} catch (ConnectionPoolTimeoutException e) {
// We'll go ahead and log this, but it should never happen.
// Exceptions are only thrown when the timeout occurs and
// since we have no timeout, it doesn't happen.
LOG.debug(
"Unexpected exception while waiting for connection",
e
);
// These exceptions are only thrown when the timeout occurs
// and since we have no timeout, it doesn't happen.
LOG.debug
("Unexpected exception while waiting for connection", e);
//@@@ throw RuntimeException or Error to indicate the problem?
}
}
}
@ -162,7 +162,7 @@ public ManagedClientConnection getConnection(HttpRoute route) {
// non-javadoc, see interface ClientConnectionManager
public ManagedClientConnection getConnection(HttpRoute route,
long timeout)
throws ConnectionPoolTimeoutException {
throws ConnectionPoolTimeoutException, InterruptedException {
if (route == null) {
throw new IllegalArgumentException("Route may not be null.");