You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Eric Johnson <er...@tibco.com> on 2005/06/15 19:50:42 UTC
HostConfiguration.equals() is synchronized - why is that?
As I was doing the changes to the Credentials implementations for
equals, I noticed that HostConfiguration.equals() is synchronized. This
isn't particularly an issue, except that hashCode() is not
synchronized. Seems like it should be both or neither.
Scanning the code, I couldn't see any place that HttpClient uses the
synchronization internally. Anyone know why this is the way it is?
-Eric.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
Re: HostConfiguration.equals() is synchronized - why is that?
Posted by Michael Becke <mb...@gmail.com>.
Agreed. I believe Oleg is correct in his recollection. I see no
reason for it to be synchronized any more.
Mike
On 6/15/05, Oleg Kalnichevski <ol...@apache.org> wrote:
> Eric,
>
> It is purely due to the historical reasons. HostConfiguration was
> initially introduced around the same time when Mike wrote
> MuitiThreadedHttpConnectionManager, which used instances of
> HostConfiguration internally to maintain maps of connection pools.
>
> A lot has changed since that time. HostConfiguration has been modified
> numerous times. These days it mainly used in "initialize one, treat as
> immutable ever after", even though the class itself is not immutable
> strictly speaking. Hence I personally think it is okay to make #equals()
> unsynchronized
>
> Oleg
>
>
>
> On Wed, 2005-06-15 at 10:50 -0700, Eric Johnson wrote:
> > As I was doing the changes to the Credentials implementations for
> > equals, I noticed that HostConfiguration.equals() is synchronized. This
> > isn't particularly an issue, except that hashCode() is not
> > synchronized. Seems like it should be both or neither.
> >
> > Scanning the code, I couldn't see any place that HttpClient uses the
> > synchronization internally. Anyone know why this is the way it is?
> >
> > -Eric.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
Re: HostConfiguration.equals() is synchronized - why is that?
Posted by Oleg Kalnichevski <ol...@apache.org>.
Eric,
It is purely due to the historical reasons. HostConfiguration was
initially introduced around the same time when Mike wrote
MuitiThreadedHttpConnectionManager, which used instances of
HostConfiguration internally to maintain maps of connection pools.
A lot has changed since that time. HostConfiguration has been modified
numerous times. These days it mainly used in "initialize one, treat as
immutable ever after", even though the class itself is not immutable
strictly speaking. Hence I personally think it is okay to make #equals()
unsynchronized
Oleg
On Wed, 2005-06-15 at 10:50 -0700, Eric Johnson wrote:
> As I was doing the changes to the Credentials implementations for
> equals, I noticed that HostConfiguration.equals() is synchronized. This
> isn't particularly an issue, except that hashCode() is not
> synchronized. Seems like it should be both or neither.
>
> Scanning the code, I couldn't see any place that HttpClient uses the
> synchronization internally. Anyone know why this is the way it is?
>
> -Eric.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org