This commit is contained in:
Clebert Suconic 2019-08-02 13:27:02 -04:00
commit 8d7831a838
2 changed files with 24 additions and 1 deletions

View File

@ -1039,6 +1039,10 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
remotingConnection.removeFailureListener(cleaner);
}
if (server.getAddressInfo(unPrefixedQueueName) == null) {
targetAddressInfos.remove(queueToDelete);
}
}
@Override
@ -1876,7 +1880,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
connectionFailed(me, failedOver);
}
private Map<SimpleString, Pair<Object, AtomicLong>> cloneTargetAddresses() {
public Map<SimpleString, Pair<Object, AtomicLong>> cloneTargetAddresses() {
return new HashMap<>(targetAddressInfos);
}

View File

@ -227,6 +227,25 @@ public class TemporaryDestinationTest extends JMSTestBase {
}
}
@Test
public void testForTempQueueTargetInfosLeak() throws Exception {
try {
conn = createConnection();
Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
TemporaryQueue temporaryQueue = s.createTemporaryQueue();
MessageProducer producer = s.createProducer(temporaryQueue);
producer.send(s.createMessage());
temporaryQueue.delete();
for (ServerSession serverSession : server.getSessions()) {
assertFalse(((ServerSessionImpl)serverSession).cloneTargetAddresses().containsKey(SimpleString.toSimpleString(temporaryQueue.getQueueName())));
}
} finally {
if (conn != null) {
conn.close();
}
}
}
@Test
public void testForSecurityCacheLeak() throws Exception {
server.getSecurityStore().setSecurityEnabled(true);