Author: gaohoward
Date: 2011-10-10 10:50:09 -0400 (Mon, 10 Oct 2011)
New Revision: 11504
Modified:
branches/STOMP11/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/v10/StompFrameHandlerV10.java
Log:
synchronize on server message as its buffer cannot be read concurrently.
Modified:
branches/STOMP11/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/v10/StompFrameHandlerV10.java
===================================================================
---
branches/STOMP11/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/v10/StompFrameHandlerV10.java 2011-10-10
13:35:57 UTC (rev 11503)
+++
branches/STOMP11/hornetq-core/src/main/java/org/hornetq/core/protocol/stomp/v10/StompFrameHandlerV10.java 2011-10-10
14:50:09 UTC (rev 11504)
@@ -322,6 +322,10 @@
{
frame.addHeader(Stomp.Headers.Message.SUBSCRIPTION, subscription.getID());
}
+
+ synchronized(serverMessage)
+ {
+
HornetQBuffer buffer = serverMessage.getBodyBuffer();
int bodyPos = serverMessage.getEndOfBodyPosition() == -1 ? buffer.writerIndex()
@@ -352,6 +356,7 @@
serverMessage.getBodyBuffer().resetReaderIndex();
StompUtils.copyStandardHeadersFromMessageToFrame(serverMessage, frame,
deliveryCount);
+ }
return frame;