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