mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-3684 - Potential deadlock in vm transport setListener when sender is blocked pending space
Deal with the case of blocked producer git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1236664 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dcf1f5e0cc
commit
e901d2fd2e
|
@ -226,6 +226,13 @@ public class VMTransport implements Transport, Task {
|
|||
|
||||
public void setTransportListener(TransportListener commandListener) {
|
||||
try {
|
||||
// enqueue can block on blocking queue, preventing turnOff
|
||||
// so avoid in that case: https://issues.apache.org/jira/browse/AMQ-3684
|
||||
if (async && getMessageQueue().remainingCapacity() == 0) {
|
||||
// enqueue blocked or will be
|
||||
this.transportListener = commandListener;
|
||||
wakeup();
|
||||
} else {
|
||||
try {
|
||||
enqueueValve.turnOff();
|
||||
this.transportListener = commandListener;
|
||||
|
@ -233,6 +240,7 @@ public class VMTransport implements Transport, Task {
|
|||
} finally {
|
||||
enqueueValve.turnOn();
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue