kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun...@apache.org
Subject kafka git commit: kafka-1815; ServerShutdownTest fails in trunk; patched by Chris Cope; reviewed by Jun Rao
Date Fri, 12 Dec 2014 19:38:03 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk e8ffbd0fe -> 0ef631bc6


kafka-1815; ServerShutdownTest fails in trunk; patched by Chris Cope; reviewed by Jun Rao


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/0ef631bc
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/0ef631bc
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/0ef631bc

Branch: refs/heads/trunk
Commit: 0ef631bc694d0c6071450c43501ca319a58859f4
Parents: e8ffbd0
Author: Chris Cope <ccope@resilientscience.com>
Authored: Fri Dec 12 11:37:57 2014 -0800
Committer: Jun Rao <junrao@gmail.com>
Committed: Fri Dec 12 11:37:57 2014 -0800

----------------------------------------------------------------------
 .../kafka/consumer/ZookeeperConsumerConnectorTest.scala |  3 ++-
 .../scala/unit/kafka/server/ServerShutdownTest.scala    | 12 ++++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/0ef631bc/core/src/test/scala/unit/kafka/consumer/ZookeeperConsumerConnectorTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/consumer/ZookeeperConsumerConnectorTest.scala
b/core/src/test/scala/unit/kafka/consumer/ZookeeperConsumerConnectorTest.scala
index 3ccccbd..a17e853 100644
--- a/core/src/test/scala/unit/kafka/consumer/ZookeeperConsumerConnectorTest.scala
+++ b/core/src/test/scala/unit/kafka/consumer/ZookeeperConsumerConnectorTest.scala
@@ -387,7 +387,8 @@ class ZookeeperConsumerConnectorTest extends JUnit3Suite with KafkaServerTestHar
     assertEquals(Set[Int](0, 1), rebalanceListener1.partitionOwnership.get(topic))
     assertEquals(true, rebalanceListener2.listenerCalled)
     assertEquals(null, rebalanceListener2.partitionOwnership.get(topic))
-
+    zkConsumerConnector1.shutdown()
+    zkConsumerConnector2.shutdown()
   }
 
   def getZKChildrenValues(path : String) : Seq[Tuple2[String,String]] = {

http://git-wip-us.apache.org/repos/asf/kafka/blob/0ef631bc/core/src/test/scala/unit/kafka/server/ServerShutdownTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/server/ServerShutdownTest.scala b/core/src/test/scala/unit/kafka/server/ServerShutdownTest.scala
index 67918f2..ba1e48e 100644
--- a/core/src/test/scala/unit/kafka/server/ServerShutdownTest.scala
+++ b/core/src/test/scala/unit/kafka/server/ServerShutdownTest.scala
@@ -141,10 +141,18 @@ class ServerShutdownTest extends JUnit3Suite with ZooKeeperTestHarness
{
     verifyNonDaemonThreadsStatus
   }
 
+  private[this] def isNonDaemonKafkaThread(t: Thread): Boolean = {
+    val threadName = Option(t.getClass.getCanonicalName)
+      .getOrElse(t.getClass.getName())
+      .toLowerCase
+
+    !t.isDaemon && t.isAlive && threadName.startsWith("kafka")
+  }
+
   def verifyNonDaemonThreadsStatus() {
     assertEquals(0, Thread.getAllStackTraces.keySet().toArray
-      .map(_.asInstanceOf[Thread])
-      .count(t => !t.isDaemon && t.isAlive && t.getClass.getCanonicalName.toLowerCase.startsWith("kafka")))
+      .map{ _.asInstanceOf[Thread] }
+      .count(isNonDaemonKafkaThread))
   }
 
   def testConsecutiveShutdown(){


Mime
View raw message