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,12 +226,20 @@ public class VMTransport implements Transport, Task {
|
|||
|
||||
public void setTransportListener(TransportListener commandListener) {
|
||||
try {
|
||||
try {
|
||||
enqueueValve.turnOff();
|
||||
// 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();
|
||||
} finally {
|
||||
enqueueValve.turnOn();
|
||||
} else {
|
||||
try {
|
||||
enqueueValve.turnOff();
|
||||
this.transportListener = commandListener;
|
||||
wakeup();
|
||||
} finally {
|
||||
enqueueValve.turnOn();
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
|
Loading…
Reference in New Issue