The 2.1.4 code for xWork is as you posted with the synchronized block. However, the 2.0.4 code does not contain the symbolization block. As a result, it appears that my threads are sometimes hanging. I am not getting any errors in the log. What is happening on occasion (not very often) is some sort of contention will happen and user threads will start hanging.
When a thread dump is done, the hung threads are all seem hung on the same HahsMap get() method from the call made in the line below: MessageFormat format = (MessageFormat) messageFormats.get(key); The line below being from the 2.0.4 code: private static MessageFormat buildMessageFormat(String pattern, Locale locale) { MessageFormatKey key = new MessageFormatKey(pattern, locale); MessageFormat format = (MessageFormat) messageFormats.get(key); if (format == null) { format = new MessageFormat(pattern); format.setLocale(locale); format.applyPattern(pattern); messageFormats.put(key, format); } return format; } Thanks, Ken -----Original Message----- From: Martin Gainty [mailto:mgai...@hotmail.com] Sent: Wednesday, July 22, 2009 7:38 PM To: Struts Users Mailing List Subject: RE: Upgrading xWork?? i'm running xwork-2.1.4 private static final Map<MessageFormatKey, MessageFormat> messageFormats = new HashMap<MessageFormatKey, MessageFormat>(); private static MessageFormat buildMessageFormat(String pattern, Locale locale) { MessageFormatKey key = new MessageFormatKey(pattern, locale); MessageFormat format = null; synchronized (messageFormats) { format = (MessageFormat) messageFormats.get(key); if (format == null) { format = new MessageFormat(pattern); format.setLocale(locale); format.applyPattern(pattern); messageFormats.put(key, format); } } return format; } //same as your latest version can you display the synchronisation errors from the log? thanks, Martin ______________________________________________ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Wed, 22 Jul 2009 13:39:02 -0700 > Subject: Re: Upgrading xWork?? > From: thechrispr...@gmail.com > To: user@struts.apache.org > > I'd still suggest making your changes to the 2.0.5 source, since it > most likely has other bug fixes that you just haven't needed yet. > (*Chris*) > > On Wed, Jul 22, 2009 at 1:21 PM, Hoying, Ken <ken_hoy...@premierinc.com>wrote: > > > I checked and it was not. Thank you though. It only seems to > > appear in the 2.1.x versions. > > > > -----Original Message----- > > From: Chris Pratt [mailto:thechrispr...@gmail.com] > > Sent: Wednesday, July 22, 2009 4:08 PM > > To: Struts Users Mailing List > > Subject: Re: Upgrading xWork?? > > > > If I remember correctly there was a 2.0.5 that was probably > > compatible with the 2.0.x versions of Struts 2, but I have no idea > > if that fix is in that version. > > (*Chris*) > > > > > > On Wed, Jul 22, 2009 at 9:47 AM, Hoying, Ken > > <ken_hoy...@premierinc.com > > >wrote: > > > > > We are running with Struts 2.0.1.1 (which uses xWork 2.0.4) and > > > are noticing that we are getting hung threads sometimes on a > > > HashMap call from com.opensymphony.xwork2.util.LocalizedTextUtil. > > > > > > It looks like the xWork code is question needs to be synchronized > > > and is causing the threads to lock due to corruption in the > > > HashMap. The problem code from xWork 2.0.4 is: > > > > > > private static MessageFormat buildMessageFormat(String pattern, > > > Locale > > > locale) { > > > MessageFormatKey key = new MessageFormatKey(pattern, locale); > > > MessageFormat format = (MessageFormat) messageFormats.get(key); > > > if (format == null) { > > > format = new MessageFormat(pattern); > > > format.setLocale(locale); > > > format.applyPattern(pattern); > > > messageFormats.put(key, format); > > > } > > > > > > return format; > > > } > > > > > > I noticed that in later version of xWork this appears to have been > > > fixed by the following change: > > > > > > private static MessageFormat buildMessageFormat(String pattern, > > > Locale > > > locale) { > > > MessageFormatKey key = new MessageFormatKey(pattern, locale); > > > MessageFormat format = null; > > > synchronized(messageFormats) { > > > format = (MessageFormat) messageFormats.get(key); > > > if (format == null) { > > > format = new MessageFormat(pattern); > > > format.setLocale(locale); > > > format.applyPattern(pattern); > > > messageFormats.put(key, format); > > > } > > > } > > > > > > return format; > > > } > > > > > > > > > > > > So my question is, has anyone attempted to upgrade the xWork > > > library to a later version in Struts 2.0.1.1? And if so, what > > > version did you use and what was your experience? > > > > > > Thank you in advance! > > > Ken > > > > > > > > > > > > ----------------------------------------- > > > ***Note:The information contained in this message may be > > > privileged and confidential and protected from disclosure. If the > > > reader of this message is not the intended recipient, or an > > > employee or agent responsible for delivering this message to the > > > intended recipient, you are hereby notified that any > > > dissemination, distribution or copying of this communication is > > > strictly prohibited. If you have received this communication in > > > error, please notify the Sender immediately by replying to the > > > message and deleting it from your computer. Thank you. Premier Inc. > > > > -------------------------------------------------------------------- > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > > For additional commands, e-mail: user-h...@struts.apache.org > > > > _________________________________________________________________ Windows LiveT Hotmail®: Celebrate the moment with your favorite sports pics. Check it out. http://www.windowslive.com/Online/Hotmail/Campaign/QuickAdd?ocid=TXT_TAGLM_WL_QA_HM_sports_photos_072009&cat=sports --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org