ARTEMIS-982 Fixing possible deadlock on AMQP.close & delivery
https://issues.apache.org/jira/browse/ARTEMIS-982 This is fixing a possible deadlock on delivering messages while AMQP close is called for any reason.
This commit is contained in:
parent
51aa18a186
commit
b788acd834
|
@ -335,11 +335,13 @@ public class AMQPConnectionContext extends ProtonInitializable {
|
|||
synchronized (getLock()) {
|
||||
connection.close();
|
||||
connection.free();
|
||||
for (AMQPSessionContext protonSession : sessions.values()) {
|
||||
protonSession.close();
|
||||
}
|
||||
sessions.clear();
|
||||
}
|
||||
|
||||
for (AMQPSessionContext protonSession : sessions.values()) {
|
||||
protonSession.close();
|
||||
}
|
||||
sessions.clear();
|
||||
|
||||
// We must force write the channel before we actually destroy the connection
|
||||
onTransport(handler.getTransport());
|
||||
destroy();
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
*/
|
||||
package org.apache.activemq.artemis.protocol.amqp.proton;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.apache.activemq.artemis.protocol.amqp.broker.AMQPSessionCallback;
|
||||
import org.apache.activemq.artemis.protocol.amqp.client.ProtonClientSenderContext;
|
||||
|
@ -44,9 +44,9 @@ public class AMQPSessionContext extends ProtonInitializable {
|
|||
|
||||
private long currentTag = 0;
|
||||
|
||||
protected Map<Receiver, ProtonServerReceiverContext> receivers = new HashMap<>();
|
||||
protected Map<Receiver, ProtonServerReceiverContext> receivers = new ConcurrentHashMap<>();
|
||||
|
||||
protected Map<Sender, ProtonServerSenderContext> senders = new HashMap<>();
|
||||
protected Map<Sender, ProtonServerSenderContext> senders = new ConcurrentHashMap<>();
|
||||
|
||||
protected boolean closed = false;
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class AMQPSessionContext extends ProtonInitializable {
|
|||
this.session = session;
|
||||
}
|
||||
|
||||
protected Map<Object, ProtonServerSenderContext> serverSenders = new HashMap<>();
|
||||
protected Map<Object, ProtonServerSenderContext> serverSenders = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public void initialise() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue