You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2015/11/13 16:50:58 UTC

[5/7] storm git commit: Some more fixes to the test so they shutdown correctly.

Some more fixes to the test so they shutdown correctly.


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/03b568fa
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/03b568fa
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/03b568fa

Branch: refs/heads/master
Commit: 03b568fae6596274d725388ec4d4e6ccfd0e2f31
Parents: 333df58
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Wed Nov 11 13:19:51 2015 -0600
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Wed Nov 11 13:19:51 2015 -0600

----------------------------------------------------------------------
 .../backtype/storm/utils/DisruptorQueueTest.java   | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/03b568fa/storm-core/test/jvm/backtype/storm/utils/DisruptorQueueTest.java
----------------------------------------------------------------------
diff --git a/storm-core/test/jvm/backtype/storm/utils/DisruptorQueueTest.java b/storm-core/test/jvm/backtype/storm/utils/DisruptorQueueTest.java
index b550bad..2ae2d35 100644
--- a/storm-core/test/jvm/backtype/storm/utils/DisruptorQueueTest.java
+++ b/storm-core/test/jvm/backtype/storm/utils/DisruptorQueueTest.java
@@ -54,8 +54,7 @@ public class DisruptorQueueTest extends TestCase {
             }
         });
 
-        run(producer, consumer);
-        queue.haltWithInterrupt();
+        run(producer, consumer, queue);
         Assert.assertEquals("We expect to receive first published message first, but received " + result.get(),
                 "FIRST", result.get());
       }
@@ -80,8 +79,7 @@ public class DisruptorQueueTest extends TestCase {
             }
         });
 
-        run(producer, consumer, 1000, 1);
-        queue.haltWithInterrupt();
+        run(producer, consumer, queue, 1000, 1);
         Assert.assertTrue("Messages delivered out of order",
                 allInOrder.get());
     }
@@ -105,19 +103,18 @@ public class DisruptorQueueTest extends TestCase {
             }
         });
 
-        run(producer, consumer, 1000, 1);
-        queue.haltWithInterrupt();
+        run(producer, consumer, queue, 1000, 1);
         Assert.assertTrue("Messages delivered out of order",
                 allInOrder.get());
     }
 
 
-    private void run(Runnable producer, Runnable consumer)
+    private void run(Runnable producer, Runnable consumer, DisruptorQueue queue)
             throws InterruptedException {
-        run(producer, consumer, 10, PRODUCER_NUM);
+        run(producer, consumer, queue, 10, PRODUCER_NUM);
     }
 
-    private void run(Runnable producer, Runnable consumer, int sleepMs, int producerNum)
+    private void run(Runnable producer, Runnable consumer, DisruptorQueue queue, int sleepMs, int producerNum)
             throws InterruptedException {
 
         Thread[] producerThreads = new Thread[producerNum];
@@ -132,12 +129,12 @@ public class DisruptorQueueTest extends TestCase {
         for (int i = 0; i < producerNum; i++) {
             producerThreads[i].interrupt();
         }
-        consumerThread.interrupt();
         
         for (int i = 0; i < producerNum; i++) {
             producerThreads[i].join(TIMEOUT);
             assertFalse("producer "+i+" is still alive", producerThreads[i].isAlive());
         }
+        queue.haltWithInterrupt();
         consumerThread.join(TIMEOUT);
         assertFalse("consumer is still alive", consumerThread.isAlive());
     }