activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r673433 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/ main/java/org/apache/activemq/state/ test/java/org/apache/activemq/ test/java/org/apache/activemq/broker/ft/
Date Wed, 02 Jul 2008 16:22:59 GMT
Author: rajdavies
Date: Wed Jul  2 09:22:59 2008
New Revision: 673433

URL: http://svn.apache.org/viewvc?rev=673433&view=rev
Log:
patch for https://issues.apache.org/activemq/browse/AMQ-1585

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/TransactedTopicMasterSlaveTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java?rev=673433&r1=673432&r2=673433&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
Wed Jul  2 09:22:59 2008
@@ -941,7 +941,7 @@
 
         try {
             transport.stop();
-            LOG.debug("Stopped connection: " + transport.getRemoteAddress());
+            LOG.debug("Stopped transport: " + transport.getRemoteAddress());
         } catch (Exception e) {
             LOG.debug("Could not stop transport: " + e, e);
         }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java?rev=673433&r1=673432&r2=673433&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java
Wed Jul  2 09:22:59 2008
@@ -383,6 +383,8 @@
                 ConnectionState cs = connectionStates.get(connectionId);
                 if (cs != null) {
                     cs.addTransactionState(info.getTransactionId());
+                    TransactionState state = cs.getTransactionState(info.getTransactionId());
+                    state.addCommand(info);
                 }
             }
             return TRACKED_RESPONSE_MARKER;

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java?rev=673433&r1=673432&r2=673433&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java
Wed Jul  2 09:22:59 2008
@@ -131,7 +131,7 @@
             for (int i = 0; i < batchSize; i++) {
                 producer.send(message);
             }
-
+            messageSent();
             session.commit();
             LOG.info("Consuming bacth " + j + " of " + batchSize + " messages");
 
@@ -145,6 +145,9 @@
         }
     }
 
+    protected void messageSent() throws Exception {
+    }
+
     /**
      * Sends a batch of messages and validates that the rollbacked message was
      * not consumed.

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/TransactedTopicMasterSlaveTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/TransactedTopicMasterSlaveTest.java?rev=673433&r1=673432&r2=673433&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/TransactedTopicMasterSlaveTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/TransactedTopicMasterSlaveTest.java
Wed Jul  2 09:22:59 2008
@@ -30,6 +30,7 @@
     protected int inflightMessageCount;
     protected int failureCount = 50;
     protected String uriString = "failover://(tcp://localhost:62001,tcp://localhost:62002)?randomize=false";
+    private boolean stopMaster = false;
 
     protected void setUp() throws Exception {
         failureCount = super.batchCount / 2;
@@ -76,12 +77,22 @@
         return new ActiveMQConnectionFactory(uriString);
     }
 
+    public void testSendReceiveTransactedBatchesWithMasterStop() throws Exception {
+        try {
+            stopMaster = true;
+            testSendReceiveTransactedBatches();
+        } finally {
+            stopMaster = false;
+        }
+    }
+    
     protected void messageSent() throws Exception {
-
-        if (++inflightMessageCount >= failureCount) {
-            inflightMessageCount = 0;
-            Thread.sleep(1000);
-            broker.stop();
+        if (stopMaster) {
+            if (++inflightMessageCount >= failureCount) {
+                inflightMessageCount = 0;
+                Thread.sleep(1000);
+                broker.stop();
+            }
         }
     }
 }



Mime
View raw message