@After public void tearDown() { ResourceBundle.clearCache(); }
/** * Releases any cached resources which were managed by this class from the {@link ResourceBundle}. */ public void clearCache() { ResourceBundle.clearCache(this.resourceClassLoader); }
/** * Clear the cache. * Call this after adding new bundles to the classpath. * @since 0.7.12 */ public static void clearCache() { _missing.clear(); _bundles.clear(); ResourceBundle.clearCache(); } }
private void cleanUpResourceBundle() { try { ResourceBundle.clearCache(this.getClass().getClassLoader()); } catch (Exception e) { logger.warn("Couldn't clean up ResourceBundle. This can cause a memory leak.", e); } }
/** * Attempts to initialize resources that should not be initialized from an application class loader. system or parent class * loader is the {@link Thread#contextClassLoader} of the current thread when method is invoked. */ public void initialize() { // When plugins have com.sun.xml.bind:jaxb-impl:jar a reference to the MuleArtifactClassLoader (plugin) will be // referenced by com.sun.xml.bind.DatatypeConverterImpl. Loading this class with the system or container class loader // will prevent this class loader leak. try { Class.forName("javax.xml.bind.DatatypeConverterImpl"); } catch (ClassNotFoundException e) { // Nothing to do... } catch (Throwable t) { logger.warn("Couldn't initialize DataTypeConverterImpl in order to prevent a class loader leak", t); } // This is done so the ResourceBundle.NONEXISTENT_BUNDLE gets loaded with the container classloader thus preventing a memory // leak. clearCache(); initializeDriverManager(); }
@Override public void dispose() { ResourceBundle.clearCache(); initialized = false; } });
/** * Removes all resource bundles from the cache that have been loaded * using the caller's class loader. * * @since 1.6 * @see ResourceBundle.Control#getTimeToLive(String,Locale) */ public static final void clearCache() { clearCache(null); }
/** * Removes all resource bundles from the cache that have been loaded * using the caller's class loader. * * @since 1.6 * @see ResourceBundle.Control#getTimeToLive(String,Locale) */ public static final void clearCache() { clearCache(null); }
/** * Releases any cached resources which were managed by this class from the {@link ResourceBundle}. */ public void clearCache() { ResourceBundle.clearCache(this.resourceClassLoader); }
static void clearResourceBundleCache(PluginClassLoader classloader) { try { ResourceBundle.clearCache(classloader); } catch (SecurityException e) { throw e; } catch (Throwable t) { // keep this silent. } }
/** * Resets any caches used directly or indirectly by the ResourceLocator. As consequence, the * bundles will be reloaded when accessing. * <p> * The cache containing the content of the bundles are usually expired at regularly time if a * such time was defined in the system properties of Silverpeas. Otherwise, this method should be * explicitly used to reset this cache and then to force the reload of the bundles' content. */ public static void resetCache() { bundles.clear(); ResourceBundle.clearCache(); }
public synchronized void flushWebResources() { resourceEntries.clear(); ResourceBundle.clearCache(this); }
/** Only clear the cache one time per request. */ private void clearCacheOnRequest(HttpServletRequest req) { if (req.getAttribute(ATTRIBUTE_CACHE_CLEARED) != null) { log.debug("Cache was already cleared on this request."); } else { ResourceBundle.clearCache(); log.debug("Cache cleared."); req.setAttribute(ATTRIBUTE_CACHE_CLEARED, Boolean.TRUE); } }
public static ResourceBundle getBundle(String filename, boolean clearCache) { ResourceBundle rb = null; try { if(clearCache) ResourceBundle.clearCache(); rb = ResourceBundle.getBundle(filename, locale, new I18NControl(ENCODING)); } catch (Exception e) { EngineLogger.error("ERROR LOADING BUNDLE: " + filename); } return rb; }
private void updateEntity(Entity entity) { RunAsSystemAspect.runAsSystem( () -> { dataService.update(entityTypeId, entity); ResourceBundle.clearCache(); // cache refresh is handled via entity listener return null; }); }
@Override public void registerResourceBundle(Bundle bundle, String className) { synchronized (classNames) { ResourceBundle.clearCache(getClassLoader(className, null)); classNames.add(className); bundleResourceCaches.put(className, new BundleProxyClassLoader(bundle)); // Iterate over existing locales in cache and add new entry for (Locale locale : resourceBundles.keySet()) { addToCache(className, locale, getCompositeProxyResourceBundleFromCache(locale)); } } }
private void removeAddOnClassLoader(AddOn addOn) { if (this.addOnLoaders.containsKey(addOn.getId())) { try (AddOnClassLoader addOnClassLoader = this.addOnLoaders.remove(addOn.getId())) { if (!addOn.getIdsAddOnDependencies().isEmpty()) { addOnClassLoader.clearDependencies(); } ResourceBundle.clearCache(addOnClassLoader); } catch (Exception e) { logger.error("Failure while closing class loader of " + addOn.getId() + " add-on:", e); } } }
/** * Restores the locale to its default value after the test. */ @AfterClass public static void restoreLocale() { Locale.setDefault(defaultLocale); TimeZone.setDefault(defaultTimezone); ResourceBundle.clearCache(); }
protected ResourceBundle getResourceBundle(String resourceName, Locale locale) { Configuration config = Configuration.getConfiguration(); if (!config.isCacheEnable()) { ResourceBundle.clearCache(); } return resourceBundleFactory.retrieveResourceBundle(resourceName, LocalizeUtil.defaultWhenNull(locale)); }
private ResourceBundle getBundle() { if (isDebug()) { ResourceBundle.clearCache(loader()); return ResourceBundle.getBundle(bundleName(), locale(), loader()); } if (this.bundle == null) { this.bundle = ResourceBundle.getBundle(bundleName(), locale(), loader()); } return this.bundle; } };