prateekm 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_r290431002
 
 

 ##########
 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:
   Would prefer to remove this RichOptional / JavaOptionals class / 
transformation from ScalaJavaUtil. I don't think it's adding any significant 
functionality, and is adding yet another "Option" class to keep track of.
   
   For this PR, it's OK to just not use it. It's also OK to use it if you think 
this will be easy to refactor away later.

----------------------------------------------------------------
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