This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-i18n.git


The following commit(s) were added to refs/heads/master by this push:
     new f9dd856  SLING-7542 : Avoid shared session/resource resolver usage     
SLING-7543 : Reduce reloading of bundles
f9dd856 is described below

commit f9dd8563c3dfc777e3a4a06813002ba9b2ada498
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Fri Mar 16 13:42:08 2018 +0100

    SLING-7542 : Avoid shared session/resource resolver usage
        SLING-7543 : Reduce reloading of bundles
---
 .../sling/i18n/impl/JcrResourceBundleProvider.java      |  2 +-
 .../org/apache/sling/i18n/impl/RootResourceBundle.java  | 17 ++---------------
 2 files changed, 3 insertions(+), 16 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java 
b/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java
index c1d64c0..ec242eb 100644
--- a/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java
+++ b/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java
@@ -131,7 +131,7 @@ public class JcrResourceBundleProvider implements 
ResourceBundleProvider, Resour
      * configuration property. This defaults to <code>Locale.ENGLISH</code> if
      * the configuration property is not set.
      */
-    private Locale defaultLocale = Locale.ENGLISH;
+    private volatile Locale defaultLocale = Locale.ENGLISH;
 
     /**
      * Map of cached resource bundles indexed by a key combined of the base 
name
diff --git a/src/main/java/org/apache/sling/i18n/impl/RootResourceBundle.java 
b/src/main/java/org/apache/sling/i18n/impl/RootResourceBundle.java
index 74cabfb..05e3a04 100644
--- a/src/main/java/org/apache/sling/i18n/impl/RootResourceBundle.java
+++ b/src/main/java/org/apache/sling/i18n/impl/RootResourceBundle.java
@@ -18,9 +18,9 @@
  */
 package org.apache.sling.i18n.impl;
 
+import java.util.Collections;
 import java.util.Enumeration;
 import java.util.Locale;
-import java.util.NoSuchElementException;
 import java.util.ResourceBundle;
 
 /**
@@ -38,18 +38,6 @@ import java.util.ResourceBundle;
  */
 public class RootResourceBundle extends ResourceBundle {
 
-    // The empty enumeration returned fomr getKeys()
-    private final Enumeration<String> EMPTY = new Enumeration<String>() {
-
-        public boolean hasMoreElements() {
-            return false;
-        }
-
-        public String nextElement() {
-            throw new NoSuchElementException();
-        }
-    };
-
     // The pseudo Locale returned by getLocale()
     private final Locale locale = new Locale("");
 
@@ -74,7 +62,6 @@ public class RootResourceBundle extends ResourceBundle {
      */
     @Override
     public Enumeration<String> getKeys() {
-        return EMPTY;
+        return Collections.emptyEnumeration();
     }
-
 }

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to