|
|
@ -125,11 +125,16 @@ public class NLS { |
|
|
|
this.locale = locale; |
|
|
|
this.locale = locale; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
private <T extends TranslationBundle> T get(Class<T> type) { |
|
|
|
private <T extends TranslationBundle> T get(Class<T> type) { |
|
|
|
TranslationBundle bundle = map.get(type); |
|
|
|
TranslationBundle bundle = map.get(type); |
|
|
|
if (bundle == null) { |
|
|
|
if (bundle == null) { |
|
|
|
bundle = GlobalBundleCache.lookupBundle(locale, type); |
|
|
|
bundle = GlobalBundleCache.lookupBundle(locale, type); |
|
|
|
map.putIfAbsent(type, bundle); |
|
|
|
// There is a small opportunity for a race, which we may
|
|
|
|
|
|
|
|
// lose. Accept defeat and return the winner's instance.
|
|
|
|
|
|
|
|
TranslationBundle old = map.putIfAbsent(type, bundle); |
|
|
|
|
|
|
|
if (old != null) |
|
|
|
|
|
|
|
bundle = old; |
|
|
|
} |
|
|
|
} |
|
|
|
return (T) bundle; |
|
|
|
return (T) bundle; |
|
|
|
} |
|
|
|
} |
|
|
|