Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Estimate class loader caching: reuse the class loader of dependencies…
…, recreate SUT class loader
  • Loading branch information
luontola committed Feb 10, 2013
1 parent 9c8e64f commit 3051283
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion jumi-core/src/main/java/fi/jumi/core/suite/SuiteFactory.java
Expand Up @@ -40,14 +40,38 @@ public class SuiteFactory implements AutoCloseable {
private RunIdSequence runIdSequence;
MultiThreadedActors actors;

private URLClassLoader cachedClassLoader;

public SuiteFactory(DaemonConfiguration daemonConfiguration, OutputCapturer outputCapturer, PrintStream logOutput) {
this.config = daemonConfiguration;
this.outputCapturer = outputCapturer;
this.logOutput = logOutput;
}

public void configure(SuiteConfiguration suite) {
testClassLoader = createClassLoader(suite.getClassPath());
List<URI> dependencies = new ArrayList<>();
List<URI> application = new ArrayList<>();
for (URI uri : suite.getClassPath()) {
String path = uri.getPath();
if (path.contains("dimdwarf") ||
path.contains("jdave") ||
path.contains("mockito") ||
path.contains("jmock")) {
application.add(uri);
} else {
dependencies.add(uri);
}
}

if (cachedClassLoader == null) {
cachedClassLoader = createClassLoader(dependencies);
}
try {
testClassLoader = new URLClassLoader(asUrls(application), cachedClassLoader);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}

testFileFinder = createTestFileFinder(suite);
driverFinder = DriverFinderFactory.createDriverFinder(testClassLoader, logOutput);
runIdSequence = new RunIdSequence();
Expand Down

0 comments on commit 3051283

Please sign in to comment.