Fixes concurrency issue where a classload in a concurrent environment with a large number of classes can cause a loss of a TypeRegistry entry

This commit is contained in:
David Estes
2020-07-01 22:17:41 -04:00
parent 59b32f957a
commit 3efc0e5530
5 changed files with 38 additions and 6 deletions

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;
}
}
}
/**

View File

@@ -0,0 +1,18 @@
package org.springsource.loaded.agent;
import java.io.File;
public interface AbstractFileSystemWatcher {
/**
* Shutdown the thread.
*/
public void shutdown();
/**
* Add a new file to the list of those being monitored. If the file is something that can be watched, then this
* method will cause the thread to start (if it hasn't already been started).
*
* @param fileToMonitor the file to start monitor
*/
public void register(File fileToMonitor);
}

View File

@@ -0,0 +1,4 @@
package org.springsource.loaded.agent;
public class MacOsFileSystemWatcher {
}

View File

@@ -0,0 +1,4 @@
package org.springsource.loaded.agent;
public class PollingFileSystemWatcher {
}