[prev in list] [next in list] [prev in thread] [next in thread]
List: httpclient-commons-dev
Subject: Re: Attempt to implement HA with HttpClient
From: alex.x.atran () jpmorgan ! com
Date: 2005-05-20 11:38:14
Message-ID: OF007CF299.60AA7649-ON80257007.003E360E-80257007.003FEBBE () jpmchase ! com
[Download RAW message or body]
--=_alternative 003FEBAA80257007_=
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
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 ma=
kes
any difference
I think this was a logical bug on my part. I think what happened was t=
hat
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 raise=
d. Searching through the logs we found some responses
contained the tomcat 401 error - authentiaction required.
Again, thanks for your help.
Regards,
AA
Ortwin Gl=FCck <ortwin.glueck@nose.ch>
19/05/2005 10:27
Please respond to "HttpClient Project"
To: HttpClient Project <httpclient-dev@jakarta.apache.org>=
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. Th=
e
> 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 get=
s
> assigned more than once. When under heavy load it is perfectly feasi=
ble
> 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: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.or=
g
This communication is for informational purposes only. It is not inten=
ded
as an offer or solicitation for the purchase or sale of any financial
instrument or as an official confirmation of any transaction. All mark=
et prices,
data and other information are not warranted as to completeness or acc=
uracy and
are subject to change without notice. Any comments or statements made =
herein
do not necessarily reflect those of JPMorgan Chase & Co., its subsidia=
ries
and affiliates
--=_alternative 003FEBAA80257007_=--
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic