[hornetq-commits] JBoss hornetq SVN: r8894 - in trunk: tests/src/org/hornetq/tests/integration/stomp and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Feb 22 09:50:37 EST 2010


Author: jmesnil
Date: 2010-02-22 09:50:36 -0500 (Mon, 22 Feb 2010)
New Revision: 8894

Modified:
   trunk/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java
   trunk/src/main/org/hornetq/core/protocol/stomp/StompSession.java
   trunk/src/main/org/hornetq/core/protocol/stomp/StompSubscription.java
   trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-129: Implement STOMP v1.0

Modified: trunk/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java	2010-02-22 11:16:15 UTC (rev 8893)
+++ trunk/src/main/org/hornetq/core/protocol/stomp/StompProtocolManager.java	2010-02-22 14:50:36 UTC (rev 8894)
@@ -65,7 +65,8 @@
 
    private final Map<String, StompSession> transactedSessions = new HashMap<String, StompSession>();
 
-   private final Map<RemotingConnection, StompSession> sessions = new HashMap<RemotingConnection, StompSession>();
+   // key => connection ID, value => Stomp session
+   private final Map<Object, StompSession> sessions = new HashMap<Object, StompSession>();
 
    // Static --------------------------------------------------------
 
@@ -140,20 +141,14 @@
 
    public void handleBuffer(final RemotingConnection connection, final HornetQBuffer buffer)
    {
-      executor.execute(new Runnable()
+      try
       {
-         public void run()
-         {
-            try
-            {
-               doHandleBuffer(connection, buffer);
-            } 
-            finally
-            {
-               server.getStorageManager().clearContext();
-            }
-         }
-      });
+         doHandleBuffer(connection, buffer);
+      } 
+      finally
+      {
+         server.getStorageManager().clearContext();
+      }
    }
    
    private void doHandleBuffer(final RemotingConnection connection, final HornetQBuffer buffer)
@@ -424,7 +419,7 @@
 
    private StompSession getSession(StompConnection connection) throws Exception
    {
-      StompSession stompSession = sessions.get(connection);
+      StompSession stompSession = sessions.get(connection.getID());
       if (stompSession == null)
       {
          stompSession = new StompSession(connection, this, server.getStorageManager().newContext(executor));
@@ -440,7 +435,7 @@
                                                       false,
                                                       stompSession);
          stompSession.setServerSession(session);
-         sessions.put(connection, stompSession);
+         sessions.put(connection.getID(), stompSession);
       }
       server.getStorageManager().setContext(stompSession.getContext());
       return stompSession;
@@ -557,7 +552,7 @@
       connection.setValid(false);
 
       try {
-         StompSession session = sessions.remove(connection);
+         StompSession session = sessions.remove(connection.getID());
          if (session != null)
          {
             try

Modified: trunk/src/main/org/hornetq/core/protocol/stomp/StompSession.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/stomp/StompSession.java	2010-02-22 11:16:15 UTC (rev 8893)
+++ trunk/src/main/org/hornetq/core/protocol/stomp/StompSession.java	2010-02-22 14:50:36 UTC (rev 8894)
@@ -19,6 +19,7 @@
 
 import org.hornetq.api.core.HornetQBuffer;
 import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.logging.Logger;
 import org.hornetq.core.message.impl.MessageImpl;
 import org.hornetq.core.persistence.OperationContext;
 import org.hornetq.core.protocol.stomp.Stomp.Headers;
@@ -37,6 +38,8 @@
  */
 class StompSession implements SessionCallback
 {
+   private static final Logger log = Logger.getLogger(StompSession.class);
+
    private final StompProtocolManager manager;
 
    private final StompConnection connection;

Modified: trunk/src/main/org/hornetq/core/protocol/stomp/StompSubscription.java
===================================================================
--- trunk/src/main/org/hornetq/core/protocol/stomp/StompSubscription.java	2010-02-22 11:16:15 UTC (rev 8893)
+++ trunk/src/main/org/hornetq/core/protocol/stomp/StompSubscription.java	2010-02-22 14:50:36 UTC (rev 8894)
@@ -52,6 +52,12 @@
       return subID;
    }
 
+   @Override
+   public String toString()
+   {
+      return "StompSubscription[id=" + subID + ", ack=" + ack + "]";
+   }
+   
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------

Modified: trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java	2010-02-22 11:16:15 UTC (rev 8893)
+++ trunk/tests/src/org/hornetq/tests/integration/stomp/StompTest.java	2010-02-22 14:50:36 UTC (rev 8894)
@@ -1433,8 +1433,7 @@
        
        frame =
           "UNSUBSCRIBE\n" +
-                  "destination:" + getQueuePrefix() + getQueueName() + "\n" +
-                  "\n\n" +
+                  "destination:" + getQueuePrefix() + getQueueName() + "\n\n" +
                   Stomp.NULL;
        sendFrame(frame);
        



More information about the hornetq-commits mailing list