jgettext/gettext-commons

I18nCache concurrent modification exception

Closed this issue · 6 comments

With gettext-commons 0.9.1.

I think the cache is broken with multiple concurrent clients.

 2008-03-10 12:11:52,512 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/].[jsp]]
El Servlet.service() para servlet jsp lanzó una excepción
java.util.ConcurrentModificationException
        at
java.util.AbstractList$Itr.checkForComodification(AbstractList.java:449)
        at java.util.AbstractList$Itr.next(AbstractList.java:420)
        at org.xnap.commons.i18n.I18nCache.get(I18nCache.java:57)
        at org.xnap.commons.i18n.I18nFactory.getI18n(I18nFactory.java:231)
        at org.xnap.commons.i18n.I18nFactory.getI18n(I18nFactory.java:180)
        at org.xnap.commons.i18n.I18nFactory.getI18n(I18nFactory.java:127)
        at org.xnap.commons.i18n.I18nFactory.getI18n(I18nFactory.java:116)

Original issue reported on code.google.com by david.calavera@gmail.com on 10 Mar 2008 at 11:32

Thank you for reporting this. We will look into it.

Original comment by berge...@gmail.com on 10 Mar 2008 at 2:21

  • Changed state: Started
Steffen, from looking at the code we didn't design it to be thread safe. Any 
reason
not to do it that I forget about? Otherwise I'd also do it for I18nFactory.

Original comment by berge...@gmail.com on 10 Mar 2008 at 2:43

That looks like a bug. It should be safe to access the code from multiple 
threads 
concurrently.

Original comment by steffen....@googlemail.com on 11 Mar 2008 at 7:20

Implemented thread safety. In the long run it might be nicer to make I18n 
immutable
and have change listeners update the locale instance maybe.

Will commit in the next few days.

Original comment by berge...@gmail.com on 10 Apr 2008 at 5:02

Attachments:

Committed. Will be part of next release.

Original comment by berge...@gmail.com on 10 Apr 2008 at 5:04

  • Changed state: Fixed
A new release has been published that contains the fix for this issue.

Original comment by berge...@gmail.com on 17 Jul 2008 at 2:02