activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r652368 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java test/java/org/apache/activemq/kaha/impl/async/DataFileAppenderTest.java
Date Wed, 30 Apr 2008 12:31:46 GMT
Author: hadrian
Date: Wed Apr 30 05:31:46 2008
New Revision: 652368

URL: http://svn.apache.org/viewvc?rev=652368&view=rev
Log:
Removed timing dependent asserts in test that could cause intermittent failures.

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/impl/async/DataFileAppenderTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java?rev=652368&r1=652367&r2=652368&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java
Wed Apr 30 05:31:46 2008
@@ -161,10 +161,8 @@
         WriteCommand write = new WriteCommand(location, data, sync);
 
         // Locate datafile and enqueue into the executor in sychronized block so
-        // that
-        // writes get equeued onto the executor in order that they were assigned
-        // by
-        // the data manager (which is basically just appending)
+        // that writes get equeued onto the executor in order that they were assigned
+        // by the data manager (which is basically just appending)
 
         synchronized (this) {
             // Find the position where this item will land at.
@@ -197,10 +195,8 @@
         WriteCommand write = new WriteCommand(location, data, onComplete);
 
         // Locate datafile and enqueue into the executor in sychronized block so
-        // that
-        // writes get equeued onto the executor in order that they were assigned
-        // by
-        // the data manager (which is basically just appending)
+        // that writes get equeued onto the executor in order that they were assigned
+        // by the data manager (which is basically just appending)
 
         synchronized (this) {
             // Find the position where this item will land at.

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/impl/async/DataFileAppenderTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/impl/async/DataFileAppenderTest.java?rev=652368&r1=652367&r2=652368&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/impl/async/DataFileAppenderTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/kaha/impl/async/DataFileAppenderTest.java
Wed Apr 30 05:31:46 2008
@@ -66,7 +66,8 @@
         for (int i=0; i<iterations; i++) {
             dataManager.write(data, false);
         }
-        assertTrue("writes are queued up", dataManager.getInflightWrites().size() >= iterations);
+        // at this point most probably dataManager.getInflightWrites().size() >= 0
+        // as the Thread created in DataFileAppender.enqueue() may not have caught up.
         Thread.sleep(1000);
         assertTrue("queued data is written", dataManager.getInflightWrites().isEmpty());
     }
@@ -76,15 +77,15 @@
         final int iterations = 10;
         final CountDownLatch latch = new CountDownLatch(iterations);
         ByteSequence data = new ByteSequence("DATA".getBytes());
-        for (int i=0; i<iterations; i++) {
+        for (int i=0; i < iterations; i++) {
             dataManager.write(data, new Runnable() {
                 public void run() {
                     latch.countDown();                 
                 }
             });
         }
-        assertTrue("writes are queued up", dataManager.getInflightWrites().size() >= iterations);
-        assertEquals("none written", iterations, latch.getCount());
+        // at this point most probably dataManager.getInflightWrites().size() >= 0
+        // as the Thread created in DataFileAppender.enqueue() may not have caught up.
         Thread.sleep(1000);
         assertTrue("queued data is written", dataManager.getInflightWrites().isEmpty());
         assertEquals("none written", 0, latch.getCount());



Mime
View raw message