aboutsummaryrefslogtreecommitdiffstats
path: root/bcel-builder
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2021-05-07 17:14:34 +0700
committerAndy Clement <aclement@pivotal.io>2022-01-13 15:07:40 -0800
commit4ee5489a4ad8276895e35bb382d84075aff9c11b (patch)
treefeeb5bf28fe88146f0ac3921d038716466844c1f /bcel-builder
parent0e58847d8d341b70734576aa813f755d9a716a18 (diff)
downloadaspectj-4ee5489a4ad8276895e35bb382d84075aff9c11b.tar.gz
aspectj-4ee5489a4ad8276895e35bb382d84075aff9c11b.zip
Optimize class loading - make backward compatible with legacy behaviour
Now the defaults are: + org.aspectj.apache.bcel.useSingleRepositoryInstance (default: false) + org.aspectj.apache.bcel.useUnavailableClassesCache (default: false) + org.aspectj.apache.bcel.ignoreCacheClearRequests (default: false) I.e. the new caching optimisations are opt-in instead of opt-out as originally designed. This might change in the future, but for now without any additional tests and experience with the new feature let us be conservative and make the build green first. I also added a few more code review findings concerning backward compatibility, which was less than 100% even with all three flags deactivated. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'bcel-builder')
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassLoaderRepository.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassLoaderRepository.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassLoaderRepository.java
index cdc072b5c..e8d8f309e 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassLoaderRepository.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassLoaderRepository.java
@@ -98,10 +98,10 @@ public class ClassLoaderRepository implements Repository {
//Cache not found classes as well to prevent unnecessary file I/O operations
public static final boolean useUnavailableClassesCache =
- System.getProperty("org.aspectj.apache.bcel.useUnavailableClassesCache", "true").equalsIgnoreCase("true");
+ System.getProperty("org.aspectj.apache.bcel.useUnavailableClassesCache", "false").equalsIgnoreCase("true");
//Ignore cache clear requests to not build up the cache over and over again
public static final boolean ignoreCacheClearRequests =
- System.getProperty("org.aspectj.apache.bcel.ignoreCacheClearRequests", "true").equalsIgnoreCase("true");
+ System.getProperty("org.aspectj.apache.bcel.ignoreCacheClearRequests", "false").equalsIgnoreCase("true");
//Second cache for the unavailable classes
private static Set<String> unavailableClasses = new HashSet<String>();
@@ -349,7 +349,9 @@ public class ClassLoaderRepository implements Repository {
classesLoadedCount++;
return clazz;
} catch (IOException e) {
- unavailableClasses.add(className);
+ if (useUnavailableClassesCache) {
+ unavailableClasses.add(className);
+ }
throw new ClassNotFoundException(e.toString());
}
}