private void forcedClearCache() { synchronized (sharedLock) { cache.clear(); cacheClassNames.clear(); clearingCounter++; for (WeakReference<Object> regedMfREf : modelFactories) { Object regedMf = regedMfREf.get(); if (regedMf != null) { if (regedMf instanceof ClassBasedModelFactory) { ((ClassBasedModelFactory) regedMf).clearCache(); } else if (regedMf instanceof ModelCache) { ((ModelCache) regedMf).clearCache(); } else { throw new BugException(); } } } removeClearedModelFactoryReferences(); } }
TemplateModel model = createModel(clazz);
public TemplateModel get(String key) throws TemplateModelException { try { return getInternal(key); } catch (Exception e) { if (e instanceof TemplateModelException) { throw (TemplateModelException) e; } else { throw new _TemplateModelException(e, "Failed to get valeu for key ", new _DelayedJQuote(key), "; see cause exception."); } } }
/** * Corresponds to {@link BeansWrapper#removeFromClassIntrospectionCache(Class)}. * * @since 2.3.20 */ void remove(Class<?> clazz) { synchronized (sharedLock) { cache.remove(clazz); cacheClassNames.remove(clazz.getName()); clearingCounter++; for (WeakReference<Object> regedMfREf : modelFactories) { Object regedMf = regedMfREf.get(); if (regedMf != null) { if (regedMf instanceof ClassBasedModelFactory) { ((ClassBasedModelFactory) regedMf).removeFromCache(clazz); } else if (regedMf instanceof ModelCache) { ((ModelCache) regedMf).clearCache(); // doesn't support selective clearing ATM } else { throw new BugException(); } } } removeClearedModelFactoryReferences(); } }
void removeIntrospectionInfo(Class clazz) { synchronized(classCache) { classCache.remove(clazz); staticModels.removeIntrospectionInfo(clazz); if(enumModels != null) { enumModels.removeIntrospectionInfo(clazz); } cachedClassNames.remove(clazz.getName()); synchronized(this) { modelCache.clearCache(); } } }
/** * Corresponds to {@link BeansWrapper#removeFromClassIntrospectionCache(Class)}. * * @since 2.3.20 */ void remove(Class<?> clazz) { synchronized (sharedLock) { cache.remove(clazz); cacheClassNames.remove(clazz.getName()); clearingCounter++; for (WeakReference<Object> regedMfREf : modelFactories) { Object regedMf = regedMfREf.get(); if (regedMf != null) { if (regedMf instanceof ClassBasedModelFactory) { ((ClassBasedModelFactory) regedMf).removeFromCache(clazz); } else if (regedMf instanceof ModelCache) { ((ModelCache) regedMf).clearCache(); // doesn't support selective clearing ATM } else { throw new BugException(); } } } removeClearedModelFactoryReferences(); } }
enumModels.clearCache();
public TemplateModel get(String key) throws TemplateModelException { synchronized(cache) { TemplateModel model = (TemplateModel)cache.get(key); if(model == null) { try { Class clazz = ClassUtil.forName(key); model = createModel(clazz); // This is called so that we trigger the // class-reloading detector. If there was a class reload, // the wrapper will in turn call our clearCache method. wrapper.introspectClass(clazz); } catch(Exception e) { throw new TemplateModelException(e); } cache.put(key, model); } return model; } }
public TemplateModel get(String key) throws TemplateModelException { try { return getInternal(key); } catch (Exception e) { if (e instanceof TemplateModelException) { throw (TemplateModelException) e; } else { throw new _TemplateModelException(e, "Failed to get valeu for key ", new _DelayedJQuote(key), "; see cause exception."); } } }
/** * Corresponds to {@link BeansWrapper#removeFromClassIntrospectionCache(Class)}. * * @since 2.3.20 */ void remove(Class<?> clazz) { synchronized (sharedLock) { cache.remove(clazz); cacheClassNames.remove(clazz.getName()); clearingCounter++; for (WeakReference<Object> regedMfREf : modelFactories) { Object regedMf = regedMfREf.get(); if (regedMf != null) { if (regedMf instanceof ClassBasedModelFactory) { ((ClassBasedModelFactory) regedMf).removeFromCache(clazz); } else if (regedMf instanceof ModelCache) { ((ModelCache) regedMf).clearCache(); // doesn't support selective clearing ATM } else { throw new BugException(); } } } removeClearedModelFactoryReferences(); } }
private void forcedClearCache() { synchronized (sharedLock) { cache.clear(); cacheClassNames.clear(); clearingCounter++; for (WeakReference<Object> regedMfREf : modelFactories) { Object regedMf = regedMfREf.get(); if (regedMf != null) { if (regedMf instanceof ClassBasedModelFactory) { ((ClassBasedModelFactory) regedMf).clearCache(); } else if (regedMf instanceof ModelCache) { ((ModelCache) regedMf).clearCache(); } else { throw new BugException(); } } } removeClearedModelFactoryReferences(); } }
TemplateModel model = createModel(clazz);
public TemplateModel get(String key) throws TemplateModelException { try { return getInternal(key); } catch (Exception e) { if (e instanceof TemplateModelException) { throw (TemplateModelException) e; } else { throw new _TemplateModelException(e, "Failed to get valeu for key ", new _DelayedJQuote(key), "; see cause exception."); } } }
private void forcedClearCache() { synchronized (sharedLock) { cache.clear(); cacheClassNames.clear(); clearingCounter++; for (WeakReference<Object> regedMfREf : modelFactories) { Object regedMf = regedMfREf.get(); if (regedMf != null) { if (regedMf instanceof ClassBasedModelFactory) { ((ClassBasedModelFactory) regedMf).clearCache(); } else if (regedMf instanceof ModelCache) { ((ModelCache) regedMf).clearCache(); } else { throw new BugException(); } } } removeClearedModelFactoryReferences(); } }
TemplateModel model = createModel(clazz);
private void introspectClassInternal(Class clazz) { String className = clazz.getName(); if(cachedClassNames.contains(className)) { if(logger.isInfoEnabled()) { logger.info("Detected a reloaded class [" + className + "]. Clearing BeansWrapper caches."); } // Class reload detected, throw away caches classCache.clear(); cachedClassNames = new HashSet(); synchronized(this) { modelCache.clearCache(); } staticModels.clearCache(); if(enumModels != null) { enumModels.clearCache(); } } classCache.put(clazz, populateClassMap(clazz)); cachedClassNames.add(className); }
enumModels.clearCache();