From 01cfa7727dfb6e680e3a94789fd0798c36dbc87c Mon Sep 17 00:00:00 2001 From: gtully Date: Tue, 26 Jul 2016 13:45:41 +0100 Subject: [PATCH] AMQ-6361 - fix additional test regression on topic sub expiry AMQ4083Test,MessageEvictionTest --- .../apache/activemq/broker/region/TopicSubscription.java | 8 +++++--- .../java/org/apache/activemq/MessageEvictionTest.java | 1 - 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java index e1c8a95a12..eff239382c 100755 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java @@ -232,12 +232,14 @@ public class TopicSubscription extends AbstractSubscription { while (matched.hasNext()) { MessageReference node = matched.next(); node.decrementReferenceCount(); - if (broker.isExpired(node)) { + if (node.isExpired()) { matched.remove(); getSubscriptionStatistics().getDispatched().increment(); node.decrementReferenceCount(); - ((Destination)node.getRegionDestination()).getDestinationStatistics().getExpired().increment(); - broker.messageExpired(getContext(), node, this); + if (broker.isExpired(node)) { + ((Destination) node.getRegionDestination()).getDestinationStatistics().getExpired().increment(); + broker.messageExpired(getContext(), node, this); + } break; } } diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/MessageEvictionTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/MessageEvictionTest.java index b079070296..567e319be8 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/MessageEvictionTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/MessageEvictionTest.java @@ -202,7 +202,6 @@ public class MessageEvictionTest { for (int i=0; i< numMessages; i++) { producer.send(session.createTextMessage(payload)); sent.incrementAndGet(); - TimeUnit.MILLISECONDS.sleep(10); } producer.close(); sendDone.countDown();