ARTEMIS-456 Synchronize sendReplicatePacket method
There is a potential deadlock scenario if 2 threads try sendReplicatePacket. Thread 1 registers Netty callback which will invoke readyForWrites() method, which locks the callback list and waits on the replicationLock. Thread 2 enters sendReplicatePacket and gets the replicationLock and is blocked on the callback list lock. This fix ensures the sendReplicatePacket blocks on the ReplicationManager meaning no interleaving of the Netty callback thread and the wait on lock can happen.
This commit is contained in:
parent
0030918fef
commit
afdb78dd5c
|
@ -330,7 +330,7 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene
|
|||
return sendReplicatePacket(packet, true);
|
||||
}
|
||||
|
||||
private OperationContext sendReplicatePacket(final Packet packet, boolean lineUp) {
|
||||
private synchronized OperationContext sendReplicatePacket(final Packet packet, boolean lineUp) {
|
||||
if (!enabled)
|
||||
return null;
|
||||
boolean runItNow = false;
|
||||
|
|
Loading…
Reference in New Issue