Hi guys,

I was thinking lately about the DN class. I know that OpenDS (and probably UnboundId, but not sure) has a DN.valueOf( "<a DN>" ) factory that returns a DN potentially leveraging a cache associated to a ThreadLocal.

At first, I thought this was an excellent idea, and started to implement such a method in the DN class, but I didn't had time to finalize the code, so I let it beside for a while.

Now that I have had a bit of discussion about caching strategy inside a server, I'm coming back to this specific valueOf() method.

I don't think it's such a good idea :
- first, as it's ThreadLocal based, you will have as many cache as you have threads processing requests. Not sure it competes with a unique cache, not sure either we can't use the memory in a better way... - second, this is a server side cache : we don'yt need it on the client side (or, more specifically, if we need it, then I don't think it deserves to be managed by the DN class)

I would rather define a dedicated class, with a static method - a factory -, something like : DnFactory, with a createDn( "<a DN>" ) method. This factory will handle its cache, which will be global.

thoughts ?

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Reply via email to