From 12d50dda308b20d2385711f195f2543bf47b917f Mon Sep 17 00:00:00 2001 From: Roland Weber Date: Sun, 11 Feb 2007 16:26:38 +0000 Subject: [PATCH] HTTPCLIENT-625 for 4.0 git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@506063 13f79535-47bb-0310-9956-ffa450edef68 --- .../http/impl/conn/ThreadSafeClientConnManager.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/java/org/apache/http/impl/conn/ThreadSafeClientConnManager.java b/src/java/org/apache/http/impl/conn/ThreadSafeClientConnManager.java index 108c489ee..f63e5ed97 100644 --- a/src/java/org/apache/http/impl/conn/ThreadSafeClientConnManager.java +++ b/src/java/org/apache/http/impl/conn/ThreadSafeClientConnManager.java @@ -117,7 +117,7 @@ public class ThreadSafeClientConnManager private ClientConnectionOperator connectionOperator; /** Indicates whether this connection manager is shut down. */ - private boolean isShutDown; + private volatile boolean isShutDown; @@ -1011,7 +1011,7 @@ private static class WaitingThread { */ private static class ReferenceQueueThread extends Thread { - private boolean isShutDown = false; + private volatile boolean isShutDown = false; /** * Create an instance and make this a daemon thread. @@ -1023,6 +1023,7 @@ public ReferenceQueueThread() { public void shutdown() { this.isShutDown = true; + this.interrupt(); } /** @@ -1056,10 +1057,8 @@ private void handleReference(Reference ref) { public void run() { while (!isShutDown) { try { - // remove the next reference and process it, a timeout - // is used so that the thread does not block indefinitely - // and therefore keep the thread from shutting down - Reference ref = REFERENCE_QUEUE.remove(1000); + // remove the next reference and process it + Reference ref = REFERENCE_QUEUE.remove(); if (ref != null) { handleReference(ref); }