Sven,
I agree with Odi that HttpMethod#abort() would be more preferable. In fact, this 
method MAY be as simple as that

public void abort() {
  HttpConnection conn = this.responseConnection;
  if (conn != null) {
     conn.shutdownInput(); // Uses reflection to call Socket#shutdownInput if available
     conn.close();
  }
}

Called from an observer thread this method will cause IOException to be thrown in the 
communication thread. A well-behaving communication thread should catch the exception 
and invoke HttpMethod#releaseConnection to return the closed connection back to the 
connection manager. End of the story.

Disclaimer: this approach worked for me quite well, but I have performed really 
extensive tests, so proceed with caution.

Cheers

Oleg

-----Original Message-----
From: Ortwin Glück [mailto:[EMAIL PROTECTED]
Sent: Friday, November 14, 2003 15:17
To: Commons HttpClient Project
Subject: Re: HttpMethodBase.releaseConnection() finished download


Sven Köhler wrote:
>> Adding the ability to abort methods is planned for the 2.1 release, 
>> but I don't think anyone has begun work on it yet.  If you come up 
>> with a good solution that you are willing to submit we would be happy 
>> to make use of it.
> 
> 
> So what would you suggest how an abort should look like? For me, a 
> boolean paramter for the releaseConnection-method would be sufficient.
> (releaseConnection() would be a shortcut to releaseConnection(boolean) 
> than).
> 
> I need this now, so i would try to implement a patch.
> 

For semantic reasons I suggest an HttpMethod::abort() method. You will 
need to create a patch against CVS HEAD. Because for the 2.0 branch it 
is definitely too late for this feature.

Maybe we will even need a HttpClient::abortAll(), but then HttpClient 
would need to know all the methods it is currently executing. That is 
easy to implement however.

Odi


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to