activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r396957 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java
Date Tue, 25 Apr 2006 19:22:33 GMT
Author: chirino
Date: Tue Apr 25 12:22:29 2006
New Revision: 396957

URL: http://svn.apache.org/viewcvs?rev=396957&view=rev
Log:

It was possible to return a marshalled command before previously added pending commands. 
And have the commands run out of order.  For examples, an unsubscribe could be executed before
all it's ack were run.  This fix forces commands to allways be run in enqueued order.


Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java?rev=396957&r1=396956&r2=396957&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompWireFormat.java
Tue Apr 25 12:22:29 2006
@@ -100,17 +100,27 @@
                 return pendingReadCommands.poll(0, TimeUnit.MILLISECONDS);
             }
         });
+        
         if (pending != null) {
             return pending;
         }
 
         try {
             Command command = commandParser.parse(in);
+            addToPendingReadCommands(command);          
+            
+            command = (Command) AsyncHelper.tryUntilNotInterrupted(new AsyncHelper.HelperWithReturn()
{
+                public Object cycle() throws InterruptedException {
+                    return pendingReadCommands.poll(0, TimeUnit.MILLISECONDS);
+                }
+            });
+            
             if( !connected ) {
                 if( command.getDataStructureType() != ConnectionInfo.DATA_STRUCTURE_TYPE
)
                     throw new IOException("Not yet connected.");
             }
             return command;
+
         }
         catch (ProtocolException e) {
             sendError(e.getMessage());



Mime
View raw message