Hi.

This discussion thread has some interesting information and points raised 
(thanks to Greg, Lukasz and Yasser).  :)

If the old logic discussed in the thread is replaced, it might be a good idea 
to try out some older and newer Tomcat versions (e.g. 7.x, 8.x, 9.x), to see if 
things still behave as expected.

The old comments also mention special handling for certain JVM implementations. 
 Even though the suggestions for replacement logic appear to use standard JDK 
calls, maybe running the same scenario/check on different JVM flavours (e.g. 
OpenJDK, OpenJ9, etc.) would be beneficial ?

The suggested logic change looks promising, in any event.  :)

Regards,

     James.

On 2020/12/02 19:50:47, Lukasz Lenart <lukaszlen...@apache.org> wrote: 
> ś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
> 
> 

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

Reply via email to