At 05:37 PM 7/11/01 -0700, you wrote:
> > > I thought you were using a WeakHashMap.
> > > Then you just do:
> > >
> > > map.put( role.getName(), role )
> > >
> > > However its not ordered. Does it need to be?
> >
> > No, it need not be ordered, so it really doesn't need
> > Comparable interface.
> >
> > How about me implementing it in BaseProfileLocator for equality?
> >
>
>What are we trying to order, ProfileLocators?
>If that is the case, then it has to be ordered in the same order as the
>primary key that you defined.
>Perhaps a TreeMap is better?
>Actually Im not sure what exactly it is your are trying to do.
>Are you creating a cache like in the CastorPSMLmanager?


Yes. I am trying to implement caching mechanism just like you did in 
CastorPsmlManager. When we put, ProfileLocator into Map, it needs a unique 
key. For FilePsmlManager it is trivial as the FileURL is going to be 
unique. But in case of ProfileLocator objects, when we put them in Map, the 
key can't be just Object now. B'cse it can happen that, there is a PSML 
available in the cache and only b'cse ProfileObject reference value is 
something different, the PsmlManager will go to the database to fetch the 
PSML. We don't want to do that. So while we check it in the Map, the key 
object if it has equals method, then the Map will properly search the value.


>Then, the only reason it would need to be orderd would be for queries,
>right?

Actually, it really need not be ordered. For all such queries, I don't 
think we should be using cache, as cache may not have all the necessary 
records, satisfying the query.

>For all other PSMLManager methods, I dont see a need for ordering...

True.

>Perhaps its best to let the db handle queries, return Profile IDs (as
>discussed in my previous email to Anil), and then go to your hashmap to get
>the objects for a little performance gain.

Perfect.


> > Role gets compared on role.getName()
> > Group gets compared on group.getName(),
> > and same goes withe the user..or do I have to use "user.getUserName()"
> > Language/Country is simple String equality.
> >
> > -Atul
>
>
>
>---------------------------------------------------------------------
>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]

Reply via email to