[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpclient-commons-dev
Subject:    [jira] Commented: (HTTPCLIENT-734) request.abort() should interrupt
From:       "Roland Weber (JIRA)" <jira () apache ! org>
Date:       2008-01-27 8:47:34
Message-ID: 1894315.1201423654925.JavaMail.jira () brutus
[Download RAW message or body]


    [ https://issues.apache.org/jira/browse/HTTPCLIENT-734?page=com.atlassian.jira.plu \
gin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562970#action_12562970 \
] 

Roland Weber commented on HTTPCLIENT-734:
-----------------------------------------

This is getting nastier the more I think about it. If abort() is called while waiting \
for a connection, the thread should be unblocked and an InterruptedException is \
thrown. If abort is called after the ConnectionReleaseTrigger (CRT) becomes \
available, the connection is released and the next IO operation will throw an \
IOException. So far, so good. If abort() is called just after the connection is \
obtained and before the CRT has been set, things get tricky. The thread will be \
interrupted, but since it is not blocked it will not get an InterruptedException. We \
have to check and reset the interrupt status, release the connection and throw an \
InterruptedException. The latter two may happen in reverse order, if the connection \
is released in a finally{} block. We'll need some synchonization and maybe a volatile \
declaration in HttpRequestBase, plus code for checking the interrupt status in \
ClientRequestDirector (CRD).

The alternative would be that applications have to do both, call abort() and \
interrupt the thread to make sure it isn't waiting for a connection. Ensuring proper \
connection release in the application would become really challenging if we require \
that.

cheers,
  Roland


> request.abort() should interrupt thread waiting for a connection
> ----------------------------------------------------------------
> 
> Key: HTTPCLIENT-734
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-734
> Project: HttpComponents HttpClient
> Issue Type: Improvement
> Affects Versions: 4.0 Alpha 2
> Reporter: Roland Weber
> Fix For: 4.0 Beta 1
> 
> Attachments: connabort.patch
> 
> 
> Calls to HttpRequestBase.abort() will not unblock a thread that is still waiting \
> for a connection and therefore has no ConnectionReleaseTrigger yet.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic