Skip to content

Commit 31d4844

Browse files
committed
Experimental change to defer loading of classes until they are processed, should in theory improve performance. (Might be reverted if it does not help)
1 parent 0a9f669 commit 31d4844

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

src/main/java/nl/rug/jbi/jsm/core/execution/ControllerThread.java

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import nl.rug.jbi.jsm.core.pipeline.PipelineFrame;
1111
import nl.rug.jbi.jsm.metrics.ClassSourceProducer;
1212
import nl.rug.jbi.jsm.util.Pair;
13-
import org.apache.bcel.classfile.JavaClass;
1413
import org.apache.bcel.util.Repository;
1514
import org.apache.logging.log4j.LogManager;
1615
import org.apache.logging.log4j.Logger;
@@ -125,15 +124,22 @@ public void run() {
125124

126125
//Create the base set of modifiers for the first frame, based on the classes that need to be inspected.
127126
for (final Map.Entry<String, EventBus> entry : this.stateContainers.entrySet()) {
128-
try {
129-
final JavaClass jc = repo.loadClass(entry.getKey());
130-
taskQueue.add(new Pair<EventBus, Runnable>(
131-
entry.getValue(),
132-
cvFactory.createClassVisitor(jc, entry.getValue())
133-
));
134-
} catch (ClassNotFoundException e) {
135-
logger.error("Failed to load '{}', it will not be evaluated.", e);
136-
}
127+
final String className = entry.getKey();
128+
final EventBus eBus = entry.getValue();
129+
130+
taskQueue.add(new Pair<EventBus, Runnable>(
131+
eBus,
132+
new Runnable() {
133+
@Override
134+
public void run() {
135+
try {
136+
cvFactory.createClassVisitor(repo.loadClass(className), eBus).run();
137+
} catch (ClassNotFoundException e) {
138+
logger.error("Failed to load '{}', it will not be evaluated.", e);
139+
}
140+
}
141+
}
142+
));
137143
}
138144

139145
while (currentFrame != null) {

0 commit comments

Comments
 (0)