Index: AbstractClientConnAdapter.java =================================================================== --- AbstractClientConnAdapter.java (revision 825665) +++ AbstractClientConnAdapter.java (working copy) @@ -86,6 +86,9 @@ /** True if the connection has been aborted. */ private volatile boolean aborted; + /** True if the connection has been released. */ + private boolean released; + /** The duration this is valid for while idle (in ms). */ private volatile long duration; @@ -316,16 +319,25 @@ } public void releaseConnection() { + synchronized(this) { + if (aborted || released) { + return; + } + released = true; + } if (connManager != null) { connManager.releaseConnection(this, duration, TimeUnit.MILLISECONDS); } } + public void abortConnection() { - if (aborted) { - return; + synchronized(this) { + if (aborted || released) { + return; + } + aborted = true; } - aborted = true; unmarkReusable(); try { shutdown();