michaelandrepearce commented on a change in pull request #2794: ARTEMIS-2451
limit size of destination cache
URL: https://github.com/apache/activemq-artemis/pull/2794#discussion_r313739151
##########
File path:
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/TemporaryDestinationTest.java
##########
@@ -266,6 +266,24 @@ public void testForTempQueueTargetInfosSizeLimit() throws
Exception {
}
}
+ @Test
+ public void testForKnownAddressSizeLimit() throws Exception {
+ try {
+ conn = createConnection();
+ Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ for (int i = 0; i < 200; i++) {
+ TemporaryQueue temporaryQueue = s.createTemporaryQueue();
+ MessageProducer producer = s.createProducer(temporaryQueue);
+ producer.send(s.createMessage());
+ }
+ assertTrue(((ActiveMQConnection)conn).getKnownDestinations().size()
<= 100);
Review comment:
it seems we already have session inside destination as such this would be
relatively easy.
expose the session on ActiveMQDestination e.g.
```
public ActiveMQSession session() {
return session;
}
```
And then in this check:
```
if (jbdest.isTemporary() && (jbdest.session() == null || connection !=
jbdest.session().getConnection())) {
```
lastly just clean up bits that we adding and removing temp address into the
cache, as redundent.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services