activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Hofstaedter (JIRA)" <j...@apache.org>
Subject [jira] Created: (AMQ-1488) Bug in FailoverTransport results in messages that have been queued during a network interruption being sent out of order upon call to restoreTransport()
Date Tue, 06 Nov 2007 14:28:23 GMT
Bug in FailoverTransport results in messages that have been queued during a network interruption
being sent out of order upon call to restoreTransport()
--------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: AMQ-1488
                 URL: https://issues.apache.org/activemq/browse/AMQ-1488
             Project: ActiveMQ
          Issue Type: Bug
          Components: Transport
    Affects Versions: 4.0.2
         Environment: Windows XP, AMQ 4.0.2, Client side message producer to an embedded broker
with a failover demand forwarding bridge to a persisting broker

            Reporter: Chris Hofstaedter


FailoverTransport stores all queued messages during network interruptions in a HashMap.  When
restoreTransport() is called, the map is traversed sending each queued message.

However, because the messages are stored in a HashMap, the map is traversed in hash-order
- not message id order.

Problematic code in FailoverTransport::restoreTransport():
        for (Iterator iter2 = requestMap.values().iterator(); iter2.hasNext();) {
            Command command = (Command) iter2.next();
            t.oneway(command);
        }

The following local patch resolves the issue:
        // Convert the request map to a treemap.  It's keyed off of the commandid and by putting
it into a treemap, we'll pull them off in commandid order.        
        TreeMap treeMap = new TreeMap();
        treeMap.putAll(requestMap);
        for (Iterator iter2 = treeMap.values().iterator(); iter2.hasNext();) {
//        for (Iterator iter2 = requestMap.values().iterator(); iter2.hasNext();) {
            Command command = (Command) iter2.next();
            t.oneway(command);
        }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message