Repository: activemq Updated Branches: refs/heads/master 4521f47e3 -> 6d14e4e85
AMQ-6979 - fix test regression, avoid gc during shutdown such that the error check on the logging remains valid Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/6d14e4e8 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/6d14e4e8 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/6d14e4e8 Branch: refs/heads/master Commit: 6d14e4e85bcf4ba37eb3c60d68773788e2cb19e1 Parents: 4521f47 Author: gtully <[email protected]> Authored: Thu May 31 13:44:01 2018 +0100 Committer: gtully <[email protected]> Committed: Thu May 31 13:44:01 2018 +0100 ---------------------------------------------------------------------- .../apache/activemq/broker/region/RegionBroker.java | 2 +- .../broker/region/DestinationGCStressTest.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/6d14e4e8/activemq-broker/src/main/java/org/apache/activemq/broker/region/RegionBroker.java ---------------------------------------------------------------------- diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/RegionBroker.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/RegionBroker.java index da6b4dc..aa0909d 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/RegionBroker.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/RegionBroker.java @@ -913,7 +913,7 @@ public class RegionBroker extends EmptyBroker { log.info("{} Inactive for longer than {} ms - removing ...", dest.getName(), dest.getInactiveTimeoutBeforeGC()); try { getRoot().removeDestination(context, dest.getActiveMQDestination(), isAllowTempAutoCreationOnSend() ? 1 : 0); - } catch (Exception e) { + } catch (Throwable e) { LOG.error("Failed to remove inactive destination {}", dest, e); } } http://git-wip-us.apache.org/repos/asf/activemq/blob/6d14e4e8/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/DestinationGCStressTest.java ---------------------------------------------------------------------- diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/DestinationGCStressTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/DestinationGCStressTest.java index c6f8409..c23c65a 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/DestinationGCStressTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/DestinationGCStressTest.java @@ -22,6 +22,7 @@ import org.apache.activemq.broker.region.policy.PolicyEntry; import org.apache.activemq.broker.region.policy.PolicyMap; import org.apache.activemq.command.ActiveMQTopic; import org.apache.activemq.util.DefaultTestAppender; +import org.apache.activemq.util.Wait; import org.apache.log4j.Appender; import org.apache.log4j.Level; import org.apache.log4j.spi.LoggingEvent; @@ -169,7 +170,7 @@ public class DestinationGCStressTest { log4jLogger.addAppender(appender); try { - final AtomicInteger max = new AtomicInteger(20000); + final AtomicInteger max = new AtomicInteger(10000); final ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://localhost?create=false"); factory.setWatchTopicAdvisories(false); @@ -218,6 +219,16 @@ public class DestinationGCStressTest { logger.info("Done"); + + Wait.waitFor(new Wait.Condition() { + @Override + public boolean isSatisified() throws Exception { + int len = ((RegionBroker)brokerService.getRegionBroker()).getTopicRegion().getDestinationMap().size(); + logger.info("Num topics: " + len); + return len == 0; + } + }); + connection.close(); } finally {
