use of freemarker.ext.util.ModelCache in project freemarker by apache.
the class ClassIntrospector method remove.
/**
* 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) {
// doesn't support selective clearing ATM
((ModelCache) regedMf).clearCache();
} else {
throw new BugException();
}
}
}
removeClearedModelFactoryReferences();
}
}
use of freemarker.ext.util.ModelCache in project freemarker by apache.
the class ClassIntrospector method forcedClearCache.
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();
}
}
Aggregations