Author: jmesnil
Date: 2010-02-08 05:28:19 -0500 (Mon, 08 Feb 2010)
New Revision: 8867
Modified:
trunk/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-129: Implement STOMP v1.0
* handle Stomp commands asynchronously
Modified: trunk/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java 2010-02-08
09:58:51 UTC (rev 8866)
+++ trunk/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java 2010-02-08
10:28:19 UTC (rev 8867)
@@ -23,6 +23,7 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.concurrent.Executor;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQBuffers;
@@ -61,6 +62,8 @@
private final Map<RemotingConnection, StompSession> sessions = new
HashMap<RemotingConnection, StompSession>();
+ private Executor executor;
+
// Static --------------------------------------------------------
private static StompFrame createError(Exception e, StompFrame request)
@@ -99,6 +102,7 @@
{
this.server = server;
this.marshaller = new StompMarshaller();
+ this.executor = server.getExecutorFactory().getExecutor();
}
// ProtocolManager implementation --------------------------------
@@ -119,8 +123,19 @@
return -1;
}
- public void handleBuffer(RemotingConnection connection, HornetQBuffer buffer)
+ public void handleBuffer(final RemotingConnection connection, final HornetQBuffer
buffer)
{
+ executor.execute(new Runnable()
+ {
+ public void run()
+ {
+ doHandleBuffer(connection, buffer);
+ }
+ });
+ }
+
+ private void doHandleBuffer(RemotingConnection connection, HornetQBuffer buffer)
+ {
StompConnection conn = (StompConnection)connection;
StompFrame request = null;
try