Am 13:49 13.01.2004 +0100 schrieb Carsten Ziegeler:
Volker Schmitt wrote:
> Carsten Ziegeler wrote:
> >Lars Rottmann wrote:
> >I know this is obvious, but I just wanted to restate it. I think we can
> >assume that the HashMap has no threading problems.
> >
> >So, has anyone a clue? Can it be the toString() method on your operating
> >system? Hmm, I don't know.
>
> Hm we don't have this effect on our machine and we have a lot of traffic.
> The only difference in our ECM Implementation is, that I have changed
> ExcaliburComponentSelector to use the component as the key and not
> component.toString(). I changed this to use the same implementation the
> ExcaliburComponentManager use. Yes ECM uses the component as key and ECS
> use component.toString(). I wanted in our Implememtation to make sure that
> ECS work if somebody implements the toString method.
> I don't believe that this can be the problem, because then it can be no
> difference between HashTable and StaticBucketMap.
>
But there is no difference between HashTable and StaticBucketMap in the ECS
and as you replaced component.toString() with component and don't have
problems,
perhaps it is the problem.

Lars, can you try this and also replace every occurence of
component.toString()
with simply component in the ECS?

Carsten

Using the component itself as key is a good step away from the toString() mess, but still not the best.
A component might change its hash value when the contents change, too.
Best way to deal with this is either a IdentityHashMap (which is java 1.4 or so) or like fortress does it with a ComponentKey class that overloads equals to compare the references of the wrapped components and a hashCode() method that uses System.identityHashCode(component).


A old mail addressing this issue (I thought the normal excalibur was thought of being kind of dead and so I didn't bother with it):
http://marc.theaimsgroup.com/?l=avalon-users&m=105403870232198&w=2
(ComponentKey has moved to avalon/fortress/container/src/impl/org/apache/avalon/fortress/impl/lookup/ComponentKey.java)


Gunnar


-- G. Brand - interface:projects GmbH Tolkewitzer Strasse 49 D-01277 Dresden mail: [EMAIL PROTECTED] tel: ++49-351-3 18 09 - 41

Ein Unternehmen der interface:business-Gruppe



Reply via email to