Skip to content
Permalink
Browse files

Estimate ideal class loader caching: reuse the class loader of all cl…

…asses
  • Loading branch information
luontola committed Feb 10, 2013
1 parent 3051283 commit b9e3015827bd38980e86f07cf1516a31ff3cb294
Showing with 3 additions and 29 deletions.
  1. +3 −29 jumi-core/src/main/java/fi/jumi/core/suite/SuiteFactory.java
@@ -17,7 +17,7 @@
import fi.jumi.core.util.*;

import javax.annotation.concurrent.NotThreadSafe;
import java.io.*;
import java.io.PrintStream;
import java.net.*;
import java.nio.file.*;
import java.util.*;
@@ -49,29 +49,10 @@ public SuiteFactory(DaemonConfiguration daemonConfiguration, OutputCapturer outp
}

public void configure(SuiteConfiguration suite) {
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);
cachedClassLoader = createClassLoader(suite.getClassPath());
}

testClassLoader = cachedClassLoader;
testFileFinder = createTestFileFinder(suite);
driverFinder = DriverFinderFactory.createDriverFinder(testClassLoader, logOutput);
runIdSequence = new RunIdSequence();
@@ -133,13 +114,6 @@ public void close() {
if (testThreadPool != null) {
testThreadPool.shutdownNow();
}
if (testClassLoader != null) {
try {
testClassLoader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}

private static URLClassLoader createClassLoader(List<URI> classpath) {

0 comments on commit b9e3015

Please sign in to comment.
You can’t perform that action at this time.