I didn’t mean inherited in the sense of the Java Language.

What I meant was, all messages (for every locale ever requested) are stored
in (HashMap) messages.  (I believe for performance reasons)

In the case where you have an ApplicationResources.properties file (default)
and a smaller one called ApplicationResources_fr.properties for our French
visitors.  You would want any message that was NOT contained in the _fr file
to be shown from the default one, right?

So, if we choose to load only the messages for the locales requested, then
every time a request is made from a _fr, the code would have to add another
loop with a synchronize ‘get’ on messages.  However, if we take care of this
ahead of time (on initialization, in a sense), we can avoid the cost later
with every request.

The problem only multiplies itself when you factor in multiple bundles and
modules.


Demonstration:
(This is my text graphic of a HashMap ;)

 ** without addIt **

+------------------+-----------+
| key              | value     |
+------------------+-----------+
| global.title     | Title     |
| global.title.fr  | Titre     |
| global.welcome   | Welcome   |
|                  |           |
|                  |           |
+------------------+-----------+



 ** with addIt **

+------------------+-----------+
| key              | value     |
+------------------+-----------+
| global.title     | Title     |
| global.title.fr  | Titre     |
| global.welcome   | Welcome   |
| global.welcome.fr| Welcome   |
|                  |           |
+------------------+-----------+



James Mitchell
Software Engineer/Struts Evangelist
http://www.open-tools.org




> -----Original Message-----
> From: Rob Leland [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 17, 2002 1:48 AM
> To: Struts Developers List
> Subject: Re: cvs commit: jakarta-struts/src/share/org/apache/struts/util
> PropertyMessageResources.java
>
>
> James Mitchell wrote:
> > Hi Rob, I don’t think those lines were doing what you thought.  Without
> > them, there is no support for inherited messages.
>
> Since doIt was a local variable I don't see how that impacts
> inherited messages.
>
> When the code below the while loop is executed
> doIt is always true, hence there is no need for it.
>
> -ROb
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to