mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
Add unInit, to fix leaked state between tests.
This commit is contained in:
@ -299,4 +299,16 @@ public class QScheduleManager
|
||||
|
||||
return (scheduler);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** reset the singleton instance (to null); clear the map of schedulers.
|
||||
** Not clear it's ever useful to call in main-code - but can be used for tests.
|
||||
*******************************************************************************/
|
||||
public void unInit()
|
||||
{
|
||||
qScheduleManager = null;
|
||||
schedulers.clear();
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,8 @@ class SimpleSchedulerTest extends BaseTest
|
||||
|
||||
assertThat(simpleScheduler.getExecutors()).isNotEmpty();
|
||||
|
||||
simpleScheduler.stopAsync();
|
||||
qScheduleManager.stop();
|
||||
qScheduleManager.unInit();
|
||||
}
|
||||
|
||||
|
||||
@ -119,6 +120,7 @@ class SimpleSchedulerTest extends BaseTest
|
||||
//////////////////////////////////////////////////
|
||||
SleepUtils.sleep(50, TimeUnit.MILLISECONDS);
|
||||
qScheduleManager.stopAsync();
|
||||
qScheduleManager.unInit();
|
||||
|
||||
System.out.println("Ran: " + BasicStep.counter + " times");
|
||||
assertTrue(BasicStep.counter > 1, "Scheduled process should have ran at least twice (but only ran [" + BasicStep.counter + "] time(s).");
|
||||
|
Reference in New Issue
Block a user