Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public class InstrumentationClassManager {
private final AtomicLong postInstrumentedSize = new AtomicLong(0);

private final Map<String, byte[]> clearCache = new HashMap<>();
private static final byte[] LOAD_FILE_FAILED = new byte[0];

private final Map<String, byte[]> heavyCache = new HashMap<>();

Expand Down Expand Up @@ -161,7 +162,7 @@ public void endLoad(long time) {
public byte[] loadUninstrumented(String name) {
long t = System.currentTimeMillis();
byte[] unInstrumented = clearCache.get(name);
if (unInstrumented == null) {
if (unInstrumented == null || unInstrumented == LOAD_FILE_FAILED) {
unInstrumented = loadUninstrumented0(name);
} else {
cacheHitCount.incrementAndGet();
Expand All @@ -176,22 +177,22 @@ private synchronized byte[] loadUninstrumented0(String name) {
unInstrumented = loadFile(name.replace('.', '/').concat(".class"), false, false);
clearCache.put(name, unInstrumented);
}
return unInstrumented;
return unInstrumented != LOAD_FILE_FAILED ? unInstrumented : null;
}

/*
* private static class PrefixingClassReader extends ClassReader { private final
* String prefix;
*
*
* PrefixingClassReader(InputStream content, String prefix) throws IOException {
* super(content); this.prefix = prefix; }
*
*
* @Override public void accept(ClassVisitor cv, Attribute[] attrs, int flags) {
* cv = new ClassRemapper( cv, new Remapper() {
*
*
* @Override public String map(String typeName) { return prefix(typeName); } });
* super.accept(cv, attrs, flags); }
*
*
* Prefixes core library class names with prefix. private String prefix(String
* typeName) { if (shouldPrefix(typeName)) { return prefix + typeName; } return
* typeName; } }
Expand Down Expand Up @@ -403,7 +404,7 @@ private byte[] loadFile(String filename, boolean tryResource, boolean tryJar) {
}
}
}
return null;
return LOAD_FILE_FAILED;
}

private byte[] loadFromJar(String jarFilename, String filename) {
Expand Down