śr., 2 gru 2020 o 10:59 Greg Huber <gregh3...@gmail.com> napisał(a):
>
> Seems we might be able to replace
>
>   try {
>                          clearMap(ResourceBundle.class, null, "cacheList");
>                      } catch (NoSuchFieldException e) {
>                          // happens in IBM JVM, that has a different
> ResourceBundle impl
>                          // it has a 'cache' member
>                          clearMap(ResourceBundle.class, null, "cache");
>                      }
>
> with
>
> ResourceBundle.clearCache();
>
> Initial testing seems to work, with no error, but not sure exactly what
> its doing???

Nice :) As far as I understand it does exactly the same thing without
a hackish approach :) Probably it would be good to iterate over the
hierarchy of ClassLoaders and clear the cache for each. Could you
register a ticket in JIRA for that?

/**
 * Removes all resource bundles from the cache that have been loaded
 * using the given class loader.
 *
 * @param loader the class loader
 * @exception NullPointerException if <code>loader</code> is null
 * @since 1.6
 * @see ResourceBundle.Control#getTimeToLive(String,Locale)
 */
public static final void clearCache(ClassLoader loader) {
    if (loader == null) {
        throw new NullPointerException();
    }
    Set<CacheKey> set = cacheList.keySet();
    for (CacheKey key : set) {
        if (key.getLoader() == loader) {
            set.remove(key);
        }
    }
}


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org
For additional commands, e-mail: dev-h...@struts.apache.org

Reply via email to