NO-JIRA Fixing intermittent failure on PagingReceiveTest

This commit is contained in:
Clebert Suconic 2020-05-28 12:41:19 -04:00
parent c5a823b687
commit 06276ff26f
2 changed files with 8 additions and 1 deletions

View File

@ -57,6 +57,7 @@ import org.apache.activemq.artemis.core.transaction.Transaction;
import org.apache.activemq.artemis.core.transaction.TransactionOperationAbstract; import org.apache.activemq.artemis.core.transaction.TransactionOperationAbstract;
import org.apache.activemq.artemis.core.transaction.TransactionPropertyIndexes; import org.apache.activemq.artemis.core.transaction.TransactionPropertyIndexes;
import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl; import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl;
import org.apache.activemq.artemis.utils.FutureLatch;
import org.apache.activemq.artemis.utils.actors.ArtemisExecutor; import org.apache.activemq.artemis.utils.actors.ArtemisExecutor;
import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet; import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashMap; import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashMap;
@ -72,6 +73,11 @@ public final class PageSubscriptionImpl implements PageSubscription {
private boolean empty = true; private boolean empty = true;
/** for tests */
public AtomicInteger getScheduledCleanupCount() {
return scheduledCleanupCount;
}
// Number of scheduled cleanups, to avoid too many schedules // Number of scheduled cleanups, to avoid too many schedules
private final AtomicInteger scheduledCleanupCount = new AtomicInteger(0); private final AtomicInteger scheduledCleanupCount = new AtomicInteger(0);

View File

@ -64,7 +64,8 @@ public class PagingReceiveTest extends ActiveMQTestBase {
Queue queue = server.locateQueue(ADDRESS); Queue queue = server.locateQueue(ADDRESS);
assertEquals(numMsgs, queue.getMessagesAdded()); assertEquals(numMsgs, queue.getMessagesAdded());
receiveAllMessages(); receiveAllMessages();
queue.getPageSubscription().cleanupEntries(true); queue.getPageSubscription().scheduleCleanupCheck();
Wait.assertEquals(0, ((PageSubscriptionImpl)queue.getPageSubscription()).getScheduledCleanupCount()::get);
assertEquals(numMsgs, queue.getMessagesAdded()); assertEquals(numMsgs, queue.getMessagesAdded());
} }