Guys,

Thanks for your help with this issue.

Things I changed to make it work:

1. Changed the executeMethod call to take in a config param:
        from:   httpclient.executeMethod(post);
        to:     httpclient.executeMethod(manager.getHostConfiguration(),
post); // ensure we are pointing at the right host

2. changed the isValidConnection test to release instead of close.
        from:   connection.close()
        to:     connection.releaseConnection(); // not sure if this makes
any difference


I think this was a logical bug on my part. I think what happened was that
the Authentiaction was being attempted against one host, but the
executeMehtod was against another host. Not exactly sure why the 
java.net.BindException: Address already in use: connect exception was raised. 
Searching through the logs we found some responses
contained the tomcat 401 error - authentiaction required.

Again, thanks for your help.

Regards,
AA





Ortwin Gl�ck <[EMAIL PROTECTED]>
19/05/2005 10:27
Please respond to "HttpClient Project"


        To:     HttpClient Project <[email protected]>
        cc:
        Subject:        Re: Attempt to implement HA with HttpClient


Oleg, I guess even Windows provides an API function that allocates a
free local port automatically. I don't think that Java handles the
allocation of the local port number in any way.

Odi

Oleg Kalnichevski wrote:
> Alex,
>
> This is just a guess on my part, so take it for what it is worth. The
> JVM randomly assigns a local port for an outbound connection, if the
> port has not been explicitly given. I assume most JVMs make no
> provisions to ensure that under no circumstances the same number gets
> assigned more than once. When under heavy load it is perfectly feasible
> that, while a connection is being established, the same number gets 
> assigned to another connection, thus causing BindException.
>
> Consider the following options:
>
> (1) reuse connections as much as possible to minimize odds of having to
> open new sockets
> (2) implement your own algorithm to assign local ports
> (3) simply retry Socket#bind method in case of BindException
>
> Hope this helps
>
> Oleg

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




This communication is for informational purposes only. It is not intended
as an offer or solicitation for the purchase or sale of any financial
instrument or as an official confirmation of any transaction. All market prices,
data and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
and affiliates

Reply via email to