I agree. What I've found with my developers is "have API, will call". So even though the best practices I've advocated are:
- Use ServiceLocator design pattern to cache a Registry where appropriate. - Use ServletContext to cache a Registry where appropriate. All the code by the implementation teams is "Registry r = RegistryBuilder.constructDefaultRegistry();". They then come to me complaining about performance issues (this method can get called as many as 20 times a Servlet request for us!). Please take a look at my proposals here: Registry API (this would be a good place to cache the default Registry and get users off of importing *.impl packages): http://wiki.apache.org/jakarta-hivemind/FeatureRequest#head-9e2d094ea5abf8ce d94e638e5b936842d4406bd4 Cheers. Naresh Sikha -----Original Message----- From: Steve Gibson [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 9:52 AM To: [email protected] Subject: RegistryBuilder.constructDefaultRegistry storing a registry instance... I have had a recurring issue migrating to HiveMind. Our old code made it simple to get a service instance by calling a static method on a particular class. In HiveMind, this is not as easy, at least not with the constraint that our code should be deployable/runnable both inside and outside a servlet container. My idea is that RegistryBuilder.constructDefaultRegistry could store the registry instance it creates, with subsequent calls returning the same instance. In fact, that's what I thought it did originally, and didn't find out until in my test case for my security service, a user would log in, but the log out test would fail, as a new registry was being created, resulting in a new singleton of my service. This static method is supposed to be a convenience method, so I don't think this would reduce functionality. If you need to be able to build multiple registries, the extra work of grabbing the Locale shouldn't be a big deal. Steve Gibson Software Engineer COWWW Software --------------------------------------------------------------------- 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]
