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.

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@396957 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2006-04-25 19:22:29 +00:00
parent 9477854858
commit 535e16a3e4
1 changed files with 10 additions and 0 deletions

View File

@ -100,17 +100,27 @@ public class StompWireFormat implements WireFormat {
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());