ARTEMIS-1935: Close of openwire connection should closes all open sessions
This is my ammending to the last commit I'm adding some extra verifications to the test and I fixed a leak that already existed on the previous map
This commit is contained in:
parent
39871157b4
commit
b360fa6063
|
@ -1013,6 +1013,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
|
|||
public void removeSession(AMQConnectionContext context, SessionInfo info) throws Exception {
|
||||
AMQSession session = sessions.remove(info.getSessionId());
|
||||
if (session != null) {
|
||||
sessionIdMap.remove(session.getCoreSession().getName());
|
||||
session.close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,12 +61,22 @@ public class SessionHandlingOpenWireTest extends BasicOpenWireTest {
|
|||
public void testInternalSessionHandlingNoSessionClose() throws Exception {
|
||||
try (Connection conn = factory.createConnection()) {
|
||||
conn.start();
|
||||
for (int i = 0; i < 100; i++) {
|
||||
Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
Destination dest = createDestination(session,ActiveMQDestination.QUEUE_TYPE);
|
||||
sendMessages(session, dest, 1);
|
||||
MessageConsumer consumer = session.createConsumer(dest);
|
||||
Message m = consumer.receive(2000);
|
||||
consumer.close();
|
||||
assertNotNull(m);
|
||||
|
||||
if (i % 2 == 1) {
|
||||
// it will close only half of the sessions
|
||||
// just to introduce error conditions
|
||||
session.close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
assertFalse(AssertionLoggerHandler.findText("Client connection failed, clearing up resources for session"));
|
||||
assertFalse(AssertionLoggerHandler.findText("Cleared up resources for session"));
|
||||
|
|
Loading…
Reference in New Issue