Permalink
Browse files

Estimate class loader caching: reuse the class loader of dependencies…

…, recreate SUT class loader
  • Loading branch information...
orfjackal committed Feb 9, 2013
1 parent 9c8e64f commit 3051283dd7a8c754045b04a4bfb957b3cf608034
Showing with 25 additions and 1 deletion.
  1. +25 −1 jumi-core/src/main/java/fi/jumi/core/suite/SuiteFactory.java
@@ -40,14 +40,38 @@
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();

0 comments on commit 3051283

Please sign in to comment.