AMQ-6979 - fix test regression, avoid gc during shutdown such that the error check on the logging remains valid

This commit is contained in:
gtully 2018-05-31 13:44:01 +01:00
parent 4521f47e36
commit 6d14e4e85b
2 changed files with 13 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -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 {