2017-03-15 20:01 GMT+01:00 Stefaan Dutry <[email protected]>: > I have a question about the pull request. > > In the interface LocaleProviderFactory, there's only a method called > createLocaleProvider. > > Does this mean that there's supposed to be a seperate instance of > LocaleProvider on every single place this is used? > (I know you could technicaly implement the interface and provide the > exact same provider, but seeing the method is named create and not get > (or obtain or something) it sounds to me that it's the intention to > return a new instance every single time) > > What is the reason that this object (the LocaleProvider) should not be reused? > Is it because ActionSupport still implements LocaleProvider? > This doesn't realy prevent that an ActionSupport instance gets used as > LocaleProvider?
Good question ... my intention was to return a new instance because it is safer, you don't need locks, synchronization, etc. Also LocaleProvider is a very simple interface with simple implementation. And as you already noticed it's connected with ActionSupport where actions are created per each request, which means its ActionContext will also be re-created each time. And as the default implementation based on ActionContext, recreating the LocaleProvider makes sense. Now you get me thinking about usage of the interface in the I18NInterceptor - a long living object - I think I need to change how it uses the LocaleProvider. > Please excuse my ignorance if this is a dumb question. Nope, there is no dumb questions :) Thank you for your insights :) Regards -- Ćukasz + 48 606 323 122 http://www.lenart.org.pl/ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
