You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Gabriel Belingueres <be...@gmail.com> on 2008/10/10 23:29:04 UTC
some questions related to WW-2834
Hi,
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) {
DEFAULT_RESOURCE_BUNDLES.clear();
DEFAULT_RESOURCE_BUNDLES.add("com/opensymphony/xwork2/xwork-messages");
}
} else {
synchronized (DEFAULT_RESOURCE_BUNDLES) {
DEFAULT_RESOURCE_BUNDLES.add("com/opensymphony/xwork2/xwork-messages");
}
}
}
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?
Gabriel
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org