NO-JIRA Fix PagingStoreImplTest#testBlockUnblock random failure
PagingStroeImpl.checkReleasedMemory() will kick off executor.execute(this::memoryReleased) to pull from the queue onMemoryFreedRunnables asynchronously. If the executor fires the task too late, it can pick up one of the late trackMemoryChecks runnable and increase its calls, making assertion fail. need to flush the executors to make sure it doesn't happen.
This commit is contained in:
parent
2269ad417e
commit
5e99516a27
|
@ -1252,6 +1252,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
|
|||
};
|
||||
store.applySetting(new AddressSettings().setMaxSizeBytes(1000).setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK));
|
||||
store.addSize(100);
|
||||
store.flushExecutors();
|
||||
store.checkMemory(trackMemoryChecks, null);
|
||||
assertEquals(1, calls.get());
|
||||
|
||||
|
@ -1270,6 +1271,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
|
|||
|
||||
store.addSize(900);
|
||||
assertEquals(100, store.getAddressLimitPercent());
|
||||
store.flushExecutors();
|
||||
|
||||
// address full blocks
|
||||
store.checkMemory(trackMemoryChecks, null);
|
||||
|
@ -1285,6 +1287,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
|
|||
assertEquals(2, calls.get());
|
||||
|
||||
store.unblock();
|
||||
store.flushExecutors();
|
||||
|
||||
// now released
|
||||
assertTrue(Wait.waitFor(new Wait.Condition() {
|
||||
|
|
Loading…
Reference in New Issue