|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
[jira] Created: (LANG-511) Initialization of available locales in LocaleUtils can be deferredInitialization of available locales in LocaleUtils can be deferred
------------------------------------------------------------------ Key: LANG-511 URL: https://issues.apache.org/jira/browse/LANG-511 Project: Commons Lang Issue Type: Improvement Affects Versions: 2.4 Reporter: Oliver Heger Priority: Minor {{LocaleUtils}} has a static initializer block that initializes the list of locales available in the system. This is done by calling {{Locale.getAvailableLocales()}}. As I had to learn, {{getAvailableLocales()}} can be very expensive, depending on the environment in which it is called. Obviously, all jars in the class path are scanned to determine the supported locales. In our project we have a large number of jars on the class path, and the invocation of the method takes between 10 and 20 seconds. There is an entry in the Java Bug Database related to this issue: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4908648 {{LocaleUtils}} contains some methods that do not need the list of available locales (and in fact it is one of those methods we would like to use). So I wonder whether the initialization of the list of available locales could be done on demand. It would then have to be synchronized, but the advantage is that the expensive initialization is only performed if it is actually required. (LANG-488 is also related to this topic.) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (LANG-511) Initialization of available locales in LocaleUtils can be deferred[ https://issues.apache.org/jira/browse/LANG-511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12727120#action_12727120 ] Henri Yandell commented on LANG-511: ------------------------------------ Taglibs has a similar performance problem. It seems that LANG-488 and this are at odds with each other. Does the set move into the get method, leading to synchronization on each call; or does every user of LocaleUtils pay for the setup for the other methods. I'm thinking... lazy loaded, with lazy loading methods looking like: public Foo getFoo() { if(foo == null) { initFoo(); } return foo; } public synchronized initFoo() { if(foo == null) { // do code to make an object for foo } return foo; } That should fix things for both complaints; while creating the complaint that the static initializer doesn't start things off :) > Initialization of available locales in LocaleUtils can be deferred > ------------------------------------------------------------------ > > Key: LANG-511 > URL: https://issues.apache.org/jira/browse/LANG-511 > Project: Commons Lang > Issue Type: Improvement > Affects Versions: 2.4 > Reporter: Oliver Heger > Priority: Minor > > {{LocaleUtils}} has a static initializer block that initializes the list of locales available in the system. This is done by calling {{Locale.getAvailableLocales()}}. > As I had to learn, {{getAvailableLocales()}} can be very expensive, depending on the environment in which it is called. Obviously, all jars in the class path are scanned to determine the supported locales. In our project we have a large number of jars on the class path, and the invocation of the method takes between 10 and 20 seconds. There is an entry in the Java Bug Database related to this issue: > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4908648 > {{LocaleUtils}} contains some methods that do not need the list of available locales (and in fact it is one of those methods we would like to use). So I wonder whether the initialization of the list of available locales could be done on demand. It would then have to be synchronized, but the advantage is that the expensive initialization is only performed if it is actually required. > (LANG-488 is also related to this topic.) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Updated: (LANG-511) Initialization of available locales in LocaleUtils can be deferred[ https://issues.apache.org/jira/browse/LANG-511?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Henri Yandell updated LANG-511: ------------------------------- Fix Version/s: 3.0 > Initialization of available locales in LocaleUtils can be deferred > ------------------------------------------------------------------ > > Key: LANG-511 > URL: https://issues.apache.org/jira/browse/LANG-511 > Project: Commons Lang > Issue Type: Improvement > Affects Versions: 2.4 > Reporter: Oliver Heger > Priority: Minor > Fix For: 3.0 > > > {{LocaleUtils}} has a static initializer block that initializes the list of locales available in the system. This is done by calling {{Locale.getAvailableLocales()}}. > As I had to learn, {{getAvailableLocales()}} can be very expensive, depending on the environment in which it is called. Obviously, all jars in the class path are scanned to determine the supported locales. In our project we have a large number of jars on the class path, and the invocation of the method takes between 10 and 20 seconds. There is an entry in the Java Bug Database related to this issue: > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4908648 > {{LocaleUtils}} contains some methods that do not need the list of available locales (and in fact it is one of those methods we would like to use). So I wonder whether the initialization of the list of available locales could be done on demand. It would then have to be synchronized, but the advantage is that the expensive initialization is only performed if it is actually required. > (LANG-488 is also related to this topic.) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (LANG-511) Initialization of available locales in LocaleUtils can be deferred[ https://issues.apache.org/jira/browse/LANG-511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12727341#action_12727341 ] Oliver Heger commented on LANG-511: ----------------------------------- Sounds like a good compromise to me. We could then make use of the techniques suggested by LANG-496. > Initialization of available locales in LocaleUtils can be deferred > ------------------------------------------------------------------ > > Key: LANG-511 > URL: https://issues.apache.org/jira/browse/LANG-511 > Project: Commons Lang > Issue Type: Improvement > Affects Versions: 2.4 > Reporter: Oliver Heger > Priority: Minor > Fix For: 3.0 > > > {{LocaleUtils}} has a static initializer block that initializes the list of locales available in the system. This is done by calling {{Locale.getAvailableLocales()}}. > As I had to learn, {{getAvailableLocales()}} can be very expensive, depending on the environment in which it is called. Obviously, all jars in the class path are scanned to determine the supported locales. In our project we have a large number of jars on the class path, and the invocation of the method takes between 10 and 20 seconds. There is an entry in the Java Bug Database related to this issue: > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4908648 > {{LocaleUtils}} contains some methods that do not need the list of available locales (and in fact it is one of those methods we would like to use). So I wonder whether the initialization of the list of available locales could be done on demand. It would then have to be synchronized, but the advantage is that the expensive initialization is only performed if it is actually required. > (LANG-488 is also related to this topic.) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Closed: (LANG-511) Initialization of available locales in LocaleUtils can be deferred[ https://issues.apache.org/jira/browse/LANG-511?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Henri Yandell closed LANG-511. ------------------------------ Resolution: Fixed svn ci -m "Moving availableLocaleSet and availableLocaleList to both lazily initialize in a separate synchronized method. This brings the two pieces of code into line with each other, allows availableLocaleSet() to be unsynchronized as desired in LANG-488 and removes the static initialization of availableLocaleList() as requested in LANG-511" src Sending src/java/org/apache/commons/lang/LocaleUtils.java Transmitting file data . Committed revision 791726. > Initialization of available locales in LocaleUtils can be deferred > ------------------------------------------------------------------ > > Key: LANG-511 > URL: https://issues.apache.org/jira/browse/LANG-511 > Project: Commons Lang > Issue Type: Improvement > Affects Versions: 2.4 > Reporter: Oliver Heger > Priority: Minor > Fix For: 3.0 > > > {{LocaleUtils}} has a static initializer block that initializes the list of locales available in the system. This is done by calling {{Locale.getAvailableLocales()}}. > As I had to learn, {{getAvailableLocales()}} can be very expensive, depending on the environment in which it is called. Obviously, all jars in the class path are scanned to determine the supported locales. In our project we have a large number of jars on the class path, and the invocation of the method takes between 10 and 20 seconds. There is an entry in the Java Bug Database related to this issue: > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4908648 > {{LocaleUtils}} contains some methods that do not need the list of available locales (and in fact it is one of those methods we would like to use). So I wonder whether the initialization of the list of available locales could be done on demand. It would then have to be synchronized, but the advantage is that the expensive initialization is only performed if it is actually required. > (LANG-488 is also related to this topic.) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
| Free embeddable forum powered by Nabble | Forum Help |