class GlobalBundleCache
extends java.lang.Object
Every translation bundle will be cached here when it gets loaded for the first time from a thread. Another lookup for the same translation bundle (same locale and type) from the same or a different thread will return the cached one.
Note that NLS instances maintain per-thread Map of loaded translation
bundles. Once a thread accesses a translation bundle it will keep reference
to it and will not call lookupBundle(Locale, Class)
again for the
same translation bundle as long as its locale doesn't change.
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<java.util.Locale,java.util.Map<java.lang.Class,TranslationBundle>> |
cachedBundles |
Constructor and Description |
---|
GlobalBundleCache() |
Modifier and Type | Method and Description |
---|---|
(package private) static <T extends TranslationBundle> |
lookupBundle(java.util.Locale locale,
java.lang.Class<T> type)
Looks up for a translation bundle in the global cache.
|
private static final java.util.Map<java.util.Locale,java.util.Map<java.lang.Class,TranslationBundle>> cachedBundles
static <T extends TranslationBundle> T lookupBundle(java.util.Locale locale, java.lang.Class<T> type)
T
- required bundle typelocale
- the preferred localetype
- required bundle typeTranslationBundleLoadingException
- see TranslationBundle.load(Locale)
TranslationStringMissingException
- see TranslationBundle.load(Locale)