You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "T.J. Hoo" <tj...@hotmail.com> on 2004/08/11 07:42:26 UTC

HttpException: Already used, but not recycled

I encounter HttpException: Already used, but not recycled.

>From the API doc, the HttpMethod.recycle() is deprecated and no longer 
supported. How should I solve this problem?

client = new HttpClient();
HttpMethod method = new 
GetMethod("http://www.klse-ris.com.my/delaystk-html/stksum.html");
while (true) {
  // can we reuse the method without having to instantiate it each loop?
  int status = client.executeMethod(method);
}

Appreciate if you can help me or point me to other resources, thank you!

_________________________________________________________________
Using a handphone prepaid card? Reload your credit online! 
http://www.msn.com.my/reloadredir/default.asp


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


Re: HttpException: Already used, but not recycled

Posted by Michael Becke <be...@u.washington.edu>.
Hi TJ,

In short the solution is to not reuse HttpMethods.  You will need to 
create new instances of the method in each run through the loop.  
Except for exceptional cases you should only need to run the loop once.

Mike

> I encounter HttpException: Already used, but not recycled.
>
> From the API doc, the HttpMethod.recycle() is deprecated and no longer 
> supported. How should I solve this problem?
>
> client = new HttpClient();
> HttpMethod method = new 
> GetMethod("http://www.klse-ris.com.my/delaystk-html/stksum.html");
> while (true) {
>  // can we reuse the method without having to instantiate it each loop?
>  int status = client.executeMethod(method);
> }
>
> Appreciate if you can help me or point me to other resources, thank 
> you!


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