cameronlee314 commented on a change in pull request #1039: SAMZA-2197: [Scala 
cleanup] Convert TaskConfig to Java 
URL: https://github.com/apache/samza/pull/1039#discussion_r290916919
 
 

 ##########
 File path: 
samza-core/src/main/scala/org/apache/samza/checkpoint/CheckpointTool.scala
 ##########
 @@ -173,13 +173,12 @@ class CheckpointTool(newOffsets: 
TaskNameToCheckpointMap, coordinatorStreamStore
     combinedConfigMap.putAll(userDefinedConfig)
     val combinedConfig: Config = new MapConfig(combinedConfigMap)
 
+    val taskConfig = new TaskConfig(combinedConfig)
     // Instantiate the checkpoint manager with coordinator stream 
configuration.
-    val checkpointManager: CheckpointManager = 
combinedConfig.getCheckpointManagerFactory() match {
-      case Some(className) =>
-        Util.getObj(className, classOf[CheckpointManagerFactory])
-          .getCheckpointManager(combinedConfig, new MetricsRegistryMap)
-      case _ =>
-        throw new SamzaException("Configuration: task.checkpoint.factory is 
not defined.")
+    val checkpointManager: CheckpointManager =
+      JavaOptionals.toRichOptional(taskConfig.getCheckpointManager(new 
MetricsRegistryMap)).toOption match {
 
 Review comment:
   Oops, I take that last comment back. I guess Scala functions aren't 
compatible with Java functions.
   For example, `val supplier: Supplier[String] = () => "hello world"` doesn't 
actually compile (IDE doesn't show the red squiggle, but build actually will 
have an error).
   So having an `Option` will allow for more natural syntax usage in Scala.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to