- Added a message to the request map in failover before sending it to prevent race condition where the response tries (and fails) to remove the message before it is even added. This is to prevent double sending a message because it is still in the requestMap. (This is for the master-slave test cases)

- Enabled a QueueBridgeTest, this test seems to pass already.
- Some minor typo correction.

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@376206 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian T. Co 2006-02-09 06:43:10 +00:00
parent 1a3021beac
commit e99fc62e4a
3 changed files with 17 additions and 7 deletions

View File

@ -344,7 +344,6 @@
<!-- This test currently fails --> <!-- This test currently fails -->
<exclude>**/ItStillMarshallsTheSameTest.*</exclude> <exclude>**/ItStillMarshallsTheSameTest.*</exclude>
<exclude>**/QueueBridgeTest.*</exclude>
<!-- https://jira.logicblaze.com/jira/browse/AMQ-502 --> <!-- https://jira.logicblaze.com/jira/browse/AMQ-502 -->
<exclude>**/StompTest.*</exclude> <exclude>**/StompTest.*</exclude>

View File

@ -37,7 +37,7 @@ public class ConnectionFailedException extends JMSException {
} }
public ConnectionFailedException() { public ConnectionFailedException() {
super("The JMS connection has failed due ti a Transport problem"); super("The JMS connection has failed due to a Transport problem");
} }
static private String extractMessage(IOException cause) { static private String extractMessage(IOException cause) {

View File

@ -320,9 +320,6 @@ public class FailoverTransport implements CompositeTransport {
break; break;
} }
// Send the message.
connectedTransport.oneway(command);
// If it was a request and it was not being tracked by // If it was a request and it was not being tracked by
// the state tracker, // the state tracker,
// then hold it in the requestMap so that we can replay // then hold it in the requestMap so that we can replay
@ -330,6 +327,20 @@ public class FailoverTransport implements CompositeTransport {
if (!stateTracker.track(command) && command.isResponseRequired()) { if (!stateTracker.track(command) && command.isResponseRequired()) {
requestMap.put(new Short(command.getCommandId()), command); requestMap.put(new Short(command.getCommandId()), command);
} }
// Send the message.
try {
connectedTransport.oneway(command);
} catch (IOException e) {
// If there is an IOException in the send, remove the command from the requestMap
if (!stateTracker.track(command) && command.isResponseRequired()) {
requestMap.remove(new Short(command.getCommandId()), command);
}
// Rethrow the exception so it will handled by the outer catch
throw e;
}
return; return;
} }