hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: help creating an aborting client (simulating connection reset)
Date Thu, 22 Jun 2006 13:01:08 GMT
Hello Paul,

> Would using HttpMethod#abort be the preferred way to
> do this

Yes.

> rather than the current brute force approach
> I have taken?

What is the brute force approach? HttpMethod#abort
closes the socket used for communication. How much
bruter can it get?

> I presume it can be fired off in a
> separate thread to the original executeMethod()?

Yes. The thread that calls executeMethod is blocked
and couldn't call anything until the execution
completes, fails, or is aborted.

> Is there some way to ensure that the connection is
> definitely canceled?

Are you trying to cancel connections or method executions?

> If my timeout value is too large,
> sometimes the operation has already finished.

There's not much you can do about that. If the operation
is finished, you can't abort it. If the server sends a
response body, your application can simply not read that
body and wait to be aborted. But then you have to do
both, call #abort on the method and interrupt your thread,
in case it isn't blocked in executeMethod anymore.

> If
> my timeout value is too small, sometimes the connection
> hasn't been established yet.

The #abort will make sure it doesn't start in the first
place.

hope that helps,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message