Hi,
Thanks for the tip. I have tried this, but ran into a problem with cookies
when using it.
I created a single HttpClient instance, with a
MultiThreadedHttpConnectionManager. I pass this client to each thread that
I start.
However, I also need to keep track of session information for each thread,
and am not sure how to do that in this model (I get another connection from
my caller, and hence another thread spawned, which must be part of the same
session). I was just calling setState as follows if the thread was part of
a particular session like this:
if (_session != null)
{
// adding session cookie previously saved");
HttpState initialState = new HttpState();
initialState.addCookie(_session);
_httpClient.setState(initialState);
}
This obviously doesn't work with multiple threads accessing the same
HttpClient.
What am I missing? Is there another way to do cookies?
thanks,
David
|---------+---------------------------->
| | Oleg Kalnichevski|
| | <[EMAIL PROTECTED]|
| | > |
| | |
| | 01/24/2005 06:13 |
| | PM |
| | Please respond to|
| | "HttpClient User |
| | Discussion" |
| | |
|---------+---------------------------->
>-----------------------------------------------------------------------------------------------------------------------|
|
|
| To: HttpClient User Discussion
<[email protected]> |
| cc:
|
| Subject: Re: Any equivalent to setReuseAddress() to true - ie reuse
sockets in TIME_WAIT state |
>-----------------------------------------------------------------------------------------------------------------------|
David,
What kind of connection manager are you using? If yes, consider using
the so called multithreaded connection manager that maintains a pool of
connections:
http://jakarta.apache.org/commons/httpclient/3.0/threading.html
Hope this helps,
Oleg
On Mon, 2005-01-24 at 15:04 -0500, [EMAIL PROTECTED] wrote:
> Hi,
>
> I am creating alot of connections to Tomcat 5 using HttpClient. As a
> result, I have a lot of sockets in the TIME_WAIT state, which lead to a
> BindException - Connection In use.
>
> Is there any way to get the HttpClient to reuse these sockets akin to
using
> setReuseAddress(true) when using a plain socket?
>
> Any other suggestions?
>
> cheers,
>
> David
>
>
>
>
> ---------------------------------------------------------------------
> 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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]