Merge pull request #225 from davydotcom/patch-type-registry-correct

Patch type registry synchronized and Fix clearing of ReflectionUtils
This commit is contained in:
Andy Clement
2020-08-27 15:04:10 -07:00
committed by GitHub
2 changed files with 21 additions and 6 deletions

View File

@@ -441,6 +441,15 @@ public class ReloadableType {
tagAsAffectedByReload();
tagSupertypesAsAffectedByReload();
tagSubtypesAsAffectedByReload();
//ReflectionUtils has a cache that needs cleared
try {
Class<?> reflecutionUtil = Class.forName("org.springframework.util.ReflectionUtils");
// java.lang.NoSuchMethodException: org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.clear()
Method clearMethod = reflecutionUtil.getMethod("clearCache");//DeclaredMethod("clear");
clearMethod.invoke(null);
} catch(Exception e3) {
//this better not blow up in my face
}
typeRegistry.fireReloadEvent(this, versionsuffix);

View File

@@ -1125,10 +1125,13 @@ public class TypeRegistry {
if (typeId >= reloadableTypes.length) {
resizeReloadableTypeArray(typeId);
}
reloadableTypes[typeId] = rtype;
if ((typeId + 1) > reloadableTypesSize) {
reloadableTypesSize = typeId + 1;
synchronized(this) {
reloadableTypes[typeId] = rtype;
if ((typeId + 1) > reloadableTypesSize) {
reloadableTypesSize = typeId + 1;
}
}
// allocatedIds.put(slashname, rtype);
// allocatedButNotYetRegisteredItds.remove(slashname);
int cglibIndex = slashname.indexOf("$$EnhancerBy");
@@ -1196,10 +1199,13 @@ public class TypeRegistry {
if (typeId >= reloadableTypes.length) {
resizeReloadableTypeArray(typeId);
}
reloadableTypes[typeId] = rtype;
if ((typeId + 1) > reloadableTypesSize) {
reloadableTypesSize = typeId + 1;
synchronized(this) {
reloadableTypes[typeId] = rtype;
if ((typeId + 1) > reloadableTypesSize) {
reloadableTypesSize = typeId + 1;
}
}
}
/**