kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gwens...@apache.org
Subject kafka git commit: KAFKA-2671: Enable starting Kafka server with a Properties object
Date Fri, 23 Oct 2015 05:28:02 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk aa56dfb9e -> 701c46b3a


KAFKA-2671: Enable starting Kafka server with a Properties object

Author: Ashish Singh <asingh@cloudera.com>

Reviewers: Eno Thereska, Gwen Shapira

Closes #330 from SinghAsDev/KAFKA-2671


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

Branch: refs/heads/trunk
Commit: 701c46b3a32da78008ae48298778fca8b5a16bce
Parents: aa56dfb
Author: Ashish Singh <asingh@cloudera.com>
Authored: Thu Oct 22 22:27:46 2015 -0700
Committer: Gwen Shapira <cshapi@gmail.com>
Committed: Thu Oct 22 22:27:46 2015 -0700

----------------------------------------------------------------------
 core/src/main/scala/kafka/Kafka.scala                   | 12 +++++-------
 .../main/scala/kafka/server/KafkaServerStartable.scala  | 11 ++++++++++-
 2 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/701c46b3/core/src/main/scala/kafka/Kafka.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/Kafka.scala b/core/src/main/scala/kafka/Kafka.scala
index 6af7b80..6b551ce 100755
--- a/core/src/main/scala/kafka/Kafka.scala
+++ b/core/src/main/scala/kafka/Kafka.scala
@@ -19,13 +19,13 @@ package kafka
 
 import java.util.Properties
 
-import scala.collection.JavaConversions._
 import joptsimple.OptionParser
-import metrics.KafkaMetricsReporter
-import server.{KafkaConfig, KafkaServerStartable, KafkaServer}
-import kafka.utils.{VerifiableProperties, CommandLineUtils, Logging}
+import kafka.server.{KafkaServer, KafkaServerStartable}
+import kafka.utils.{CommandLineUtils, Logging}
 import org.apache.kafka.common.utils.Utils
 
+import scala.collection.JavaConversions._
+
 object Kafka extends Logging {
 
   def getPropsFromArgs(args: Array[String]): Properties = {
@@ -55,9 +55,7 @@ object Kafka extends Logging {
   def main(args: Array[String]): Unit = {
     try {
       val serverProps = getPropsFromArgs(args)
-      val serverConfig = KafkaConfig.fromProps(serverProps)
-      KafkaMetricsReporter.startReporters(new VerifiableProperties(serverProps))
-      val kafkaServerStartable = new KafkaServerStartable(serverConfig)
+      val kafkaServerStartable = KafkaServerStartable.fromProps(serverProps)
 
       // attach shutdown handler to catch control-c
       Runtime.getRuntime().addShutdownHook(new Thread() {

http://git-wip-us.apache.org/repos/asf/kafka/blob/701c46b3/core/src/main/scala/kafka/server/KafkaServerStartable.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/server/KafkaServerStartable.scala b/core/src/main/scala/kafka/server/KafkaServerStartable.scala
index df521b3..fc98912 100644
--- a/core/src/main/scala/kafka/server/KafkaServerStartable.scala
+++ b/core/src/main/scala/kafka/server/KafkaServerStartable.scala
@@ -17,8 +17,17 @@
 
 package kafka.server
 
-import kafka.utils.Logging
+import java.util.Properties
 
+import kafka.metrics.KafkaMetricsReporter
+import kafka.utils.{VerifiableProperties, Logging}
+
+object KafkaServerStartable {
+  def fromProps(serverProps: Properties) = {
+    KafkaMetricsReporter.startReporters(new VerifiableProperties(serverProps))
+    new KafkaServerStartable(KafkaConfig.fromProps(serverProps))
+  }
+}
 
 class KafkaServerStartable(val serverConfig: KafkaConfig) extends Logging {
   private val server = new KafkaServer(serverConfig)


Mime
View raw message