activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r906697 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java
Date Thu, 04 Feb 2010 22:33:33 GMT
Author: gtully
Date: Thu Feb  4 22:33:33 2010
New Revision: 906697

URL: http://svn.apache.org/viewvc?rev=906697&view=rev
Log:
allow for transaction rolledback exception: https://issues.apache.org/activemq/browse/AMQ-2590

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java?rev=906697&r1=906696&r2=906697&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java Thu
Feb  4 22:33:33 2010
@@ -31,6 +31,7 @@
 import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.jms.Topic;
+import javax.jms.TransactionRolledBackException;
 
 import junit.framework.TestCase;
 
@@ -172,10 +173,11 @@
             return nextExpectedSeqNum;
         }
         
+        final int TRANSACITON_BATCH = 500;
         public void onMessage(Message message) {
             try {
                 final long seqNum = message.getLongProperty(SEQ_NUM_PROPERTY);
-                if ((seqNum % 500) == 0) {
+                if ((seqNum % TRANSACITON_BATCH) == 0) {
                     LOG.info(dest + " received " + seqNum);
                     
                     if (transactional) {
@@ -195,6 +197,10 @@
                 }
                 ++nextExpectedSeqNum;
                 lastId = message.getJMSMessageID();
+            } catch (TransactionRolledBackException expectedSometimesOnFailoverRecovery)
{
+                LOG.info("got rollback: " + expectedSometimesOnFailoverRecovery);
+                // batch will be replayed
+                nextExpectedSeqNum -= (TRANSACITON_BATCH -1);
             } catch (Throwable e) {
                 LOG.error(dest + " onMessage error", e);
                 exceptions.add(e);



Mime
View raw message