Author: gaohoward
Date: 2011-09-25 04:18:23 -0400 (Sun, 25 Sep 2011)
New Revision: 11411
Modified:
branches/STOMP11/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompConnection.java
Log:
deadlock found in perf test
Modified:
branches/STOMP11/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompConnection.java
===================================================================
---
branches/STOMP11/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompConnection.java 2011-09-25
07:39:38 UTC (rev 11410)
+++
branches/STOMP11/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/StompConnection.java 2011-09-25
08:18:23 UTC (rev 11411)
@@ -80,6 +80,8 @@
private boolean initialized;
private FrameEventListener stompListener;
+
+ private final Object sendLock = new Object();
public StompDecoder getDecoder()
{
@@ -202,7 +204,10 @@
internalClose();
- callClosingListeners();
+ synchronized(sendLock)
+ {
+ callClosingListeners();
+ }
}
private void internalClose()
@@ -698,7 +703,11 @@
public void physicalSend(StompFrame frame) throws Exception
{
HornetQBuffer buffer = frame.toHornetQBuffer();
- getTransportConnection().write(buffer, false, false);
+
+ synchronized (sendLock)
+ {
+ getTransportConnection().write(buffer, false, false);
+ }
if (stompListener != null)
{