struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gabriel Belingueres" <>
Subject some questions related to WW-2834
Date Fri, 10 Oct 2008 21:29:04 GMT

This bug seems to be already fixed in S2.1.

However, reading the source code of LocalizedTextUtil some questions
aroused that I like to ask (because perhaps I'm understanding wrongly
some concurrency issues):

1) The MessageFormat is not thread-safe, but a trick is applied to get
all used message formats into a Map to avoid instantiation of the
MessageFormat every time. However this comes to the cost of
synchronizing the map and therefore serializing the requests? Even for
the map a MessageFormatKey is instantiated every time so the
instantiated object count is the same that if creating a MessageFormat
AND without the synchronization block. If you ask me, I favor to
prioritize concurrency than memory. Is this right?

2) DEFAULT_RESOURCE_BUNDLES is a SynchronizedList, which to me is
redundant since every time is accessed inside a synchronized block. Is
this right?

3) This method:
    public static void clearDefaultResourceBundles() {
        if (DEFAULT_RESOURCE_BUNDLES != null) {
            synchronized (DEFAULT_RESOURCE_BUNDLES) {

        } else {
            synchronized (DEFAULT_RESOURCE_BUNDLES) {


DEFAULT_RESOURCE_BUNDLES is never null-ed inside the class. Can it be
null-ed by some class reloading effect? Is the else clause fine?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message