HHH-16911 Don't wait for 3m in the self-test of ClassLoaderLeaksUtilityTest
This commit is contained in:
parent
b758ddafa6
commit
b562c81c76
|
@ -38,6 +38,11 @@ public final class ClassLoaderLeakDetector {
|
||||||
return PhantomReferenceLeakDetector.verifyActionNotLeaking( () -> actionInClassloader( fullClassnameOfRunnableAction ) );
|
return PhantomReferenceLeakDetector.verifyActionNotLeaking( () -> actionInClassloader( fullClassnameOfRunnableAction ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boolean verifyActionNotLeakingClassloader(String fullClassnameOfRunnableAction, final int gcAttempts, final int totalWaitSeconds) {
|
||||||
|
Objects.requireNonNull( fullClassnameOfRunnableAction );
|
||||||
|
return PhantomReferenceLeakDetector.verifyActionNotLeaking( () -> actionInClassloader( fullClassnameOfRunnableAction ), gcAttempts, totalWaitSeconds );
|
||||||
|
}
|
||||||
|
|
||||||
public static ClassLoader actionInClassloader(final String actionName) {
|
public static ClassLoader actionInClassloader(final String actionName) {
|
||||||
final Thread currentThread = Thread.currentThread();
|
final Thread currentThread = Thread.currentThread();
|
||||||
final ClassLoader initialClassloader = currentThread.getContextClassLoader();
|
final ClassLoader initialClassloader = currentThread.getContextClassLoader();
|
||||||
|
|
|
@ -16,7 +16,9 @@ public class ClassLoaderLeaksUtilityTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testClassLoaderLeaksDetected() {
|
public void testClassLoaderLeaksDetected() {
|
||||||
Assert.assertFalse( ClassLoaderLeakDetector.verifyActionNotLeakingClassloader( "org.hibernate.orm.test.bootstrap.registry.classloading.LeakingTestAction" ) );
|
//N.B. since we expect to timeout in this case, reduce the timeouts to not require
|
||||||
|
//a significant amount of time during each ORM test run.
|
||||||
|
Assert.assertFalse( ClassLoaderLeakDetector.verifyActionNotLeakingClassloader( "org.hibernate.orm.test.bootstrap.registry.classloading.LeakingTestAction", 2 , 2 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue