fix wrong ClassLoader for Delayed-Restart Thread, which has caused an ClassLoader leak.

Also added system properties to configure shutdown only, wait between stop and start and possibility to disable gc.
This commit is contained in:
Sebastian Sdorra
2019-11-21 16:20:55 +01:00
parent 755b99f524
commit d1a5f6f24b
6 changed files with 97 additions and 25 deletions

View File

@@ -18,11 +18,13 @@ class InjectionContextRestartStrategyTest {
@Mock
private RestartStrategy.InjectionContext context;
private InjectionContextRestartStrategy strategy = new InjectionContextRestartStrategy();
private InjectionContextRestartStrategy strategy = new InjectionContextRestartStrategy(Thread.currentThread().getContextClassLoader());
@BeforeEach
void setWaitToZero() {
strategy.setWaitInMs(0L);
// disable gc during tests
strategy.setGcEnabled(false);
}
@Test
@@ -47,7 +49,6 @@ class InjectionContextRestartStrategyTest {
@Test
void shouldRegisterContextAfterRestart() throws InterruptedException {
TestingInjectionContext ctx = new TestingInjectionContext();
strategy.restart(ctx);
Thread.sleep(50L);