Package se.jiderhamn.classloader.leak
Class JUnitClassloaderRunner.SeparateClassLoaderInvokeMethod
- java.lang.Object
-
- org.junit.runners.model.Statement
-
- org.junit.internal.runners.statements.InvokeMethod
-
- se.jiderhamn.classloader.leak.JUnitClassloaderRunner.SeparateClassLoaderInvokeMethod
-
- Enclosing class:
- JUnitClassloaderRunner
private class JUnitClassloaderRunner.SeparateClassLoaderInvokeMethod extends org.junit.internal.runners.statements.InvokeMethod
-
-
Field Summary
Fields Modifier and Type Field Description private booleandumpHeapOnErrorAutomatically generate a heap dump of classloader could not be garbage collected?private booleanexpectedLeakIs the test method expeced to leak?private booleanhaltBeforeErrorShould the thread pause for a couple of seconds before throwing the test failed error? Set this to true to allow some time to aquire a heap dump to track down leaks.private java.lang.String[]ignoredPackagesPackages to be ignored byRedefiningClassLoader.private java.lang.reflect.MethodoriginalMethodThe method to run for triggering potential leak, or verify non-leakprivate java.lang.Class<? extends java.lang.Runnable>preventorClassClass that can be used to remove the leak
-
Constructor Summary
Constructors Modifier Constructor Description privateSeparateClassLoaderInvokeMethod(org.junit.runners.model.FrameworkMethod testMethod, java.lang.Object target)privateSeparateClassLoaderInvokeMethod(org.junit.runners.model.FrameworkMethod testMethod, java.lang.Object target, java.lang.Class<? extends java.lang.Runnable> preventorClass, PackagesLoadedOutsideClassLoader packagesLoadedOutsideClassLoader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidevaluate()private voidperformErrorActions(java.lang.String testName)Call only if there is a leak
-
-
-
Field Detail
-
originalMethod
private final java.lang.reflect.Method originalMethod
The method to run for triggering potential leak, or verify non-leak
-
expectedLeak
private final boolean expectedLeak
Is the test method expeced to leak?
-
haltBeforeError
private final boolean haltBeforeError
Should the thread pause for a couple of seconds before throwing the test failed error? Set this to true to allow some time to aquire a heap dump to track down leaks.
-
dumpHeapOnError
private final boolean dumpHeapOnError
Automatically generate a heap dump of classloader could not be garbage collected?
-
preventorClass
private java.lang.Class<? extends java.lang.Runnable> preventorClass
Class that can be used to remove the leak
-
ignoredPackages
private final java.lang.String[] ignoredPackages
Packages to be ignored byRedefiningClassLoader. If null, will use defaults.
-
-
Constructor Detail
-
SeparateClassLoaderInvokeMethod
private SeparateClassLoaderInvokeMethod(org.junit.runners.model.FrameworkMethod testMethod, java.lang.Object target)
-
SeparateClassLoaderInvokeMethod
private SeparateClassLoaderInvokeMethod(org.junit.runners.model.FrameworkMethod testMethod, java.lang.Object target, java.lang.Class<? extends java.lang.Runnable> preventorClass, PackagesLoadedOutsideClassLoader packagesLoadedOutsideClassLoader)
-
-
Method Detail
-
evaluate
public void evaluate() throws java.lang.Throwable- Overrides:
evaluatein classorg.junit.internal.runners.statements.InvokeMethod- Throws:
java.lang.Throwable
-
performErrorActions
private void performErrorActions(java.lang.String testName) throws java.lang.InterruptedExceptionCall only if there is a leak- Throws:
java.lang.InterruptedException
-
-