[hornetq-commits] JBoss hornetq SVN: r8944 - trunk/src/main/org/hornetq/core/protocol/stomp.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Mar 22 14:00:56 EDT 2010
Author: jmesnil
Date: 2010-03-22 14:00:55 -0400 (Mon, 22 Mar 2010)
New Revision: 8944
Modified:
trunk/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-129: Implement STOMP v1.0
* do not wait for storage operation completion when *delivering* messages
Modified: trunk/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java 2010-03-22 17:29:50 UTC (rev 8943)
+++ trunk/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java 2010-03-22 18:00:55 UTC (rev 8944)
@@ -223,7 +223,7 @@
if (response != null)
{
- send(conn, response);
+ sendReply(conn, response);
}
if (Stomp.Commands.DISCONNECT.equals(command))
@@ -237,13 +237,38 @@
StompFrame error = createError(e, request);
if (error != null)
{
- send(conn, error);
+ sendReply(conn, error);
}
}
}
// Public --------------------------------------------------------
+ public void send(final StompConnection connection, final StompFrame frame)
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("sent " + frame);
+ }
+ synchronized (connection)
+ {
+ if (connection.isDestroyed() || !connection.isValid())
+ {
+ log.warn("Connection closed " + connection);
+ return;
+ }
+
+ try
+ {
+ HornetQBuffer buffer = frame.toHornetQBuffer();
+ connection.getTransportConnection().write(buffer, false);
+ }
+ catch (Exception e)
+ {
+ log.error("Unable to send frame " + frame, e);
+ }
+ }
+ }
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@@ -528,25 +553,6 @@
return new StompFrame(Stomp.Responses.CONNECTED, h);
}
- public void send(final StompConnection connection, final StompFrame frame)
- {
- server.getStorageManager().afterCompleteOperations(new IOAsyncTask()
- {
- public void onError(final int errorCode, final String errorMessage)
- {
- log.warn("Error processing IOCallback code = " + errorCode + " message = " + errorMessage);
-
- StompFrame error = createError(new HornetQException(errorCode, errorMessage), frame);
- doSend(connection, error);
- }
-
- public void done()
- {
- doSend(connection, frame);
- }
- });
- }
-
public void cleanup(StompConnection connection)
{
connection.setValid(false);
@@ -595,32 +601,23 @@
}
}
- private void doSend(final StompConnection connection, final StompFrame frame)
+ private void sendReply(final StompConnection connection, final StompFrame frame)
{
- if (log.isTraceEnabled())
+ server.getStorageManager().afterCompleteOperations(new IOAsyncTask()
{
- log.trace("sent " + frame);
- }
- synchronized (connection)
- {
- if (connection.isDestroyed() || !connection.isValid())
+ public void onError(final int errorCode, final String errorMessage)
{
- log.warn("Connection closed " + connection);
- return;
+ log.warn("Error processing IOCallback code = " + errorCode + " message = " + errorMessage);
+
+ StompFrame error = createError(new HornetQException(errorCode, errorMessage), frame);
+ send(connection, error);
}
- try
+ public void done()
{
- HornetQBuffer buffer = frame.toHornetQBuffer();
- connection.getTransportConnection().write(buffer, false);
+ send(connection, frame);
}
- catch (Exception e)
- {
- log.error("Unable to send frame " + frame, e);
- }
- }
+ });
}
-
-
// Inner classes -------------------------------------------------
}
More information about the hornetq-commits
mailing list