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_r291300577
 
 

 ##########
 File path: 
samza-core/src/main/scala/org/apache/samza/checkpoint/CheckpointTool.scala
 ##########
 @@ -158,14 +159,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) =>
-        ReflectionUtil.getObj(classLoader, 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, classLoader))
 
 Review comment:
   I tried that, but the Scala syntax for a 0-arg method isn't compatible with 
Java `Supplier`.
   For example, in Scala, `val supplier: Supplier[String] = () => "hello 
world"` is a "type mismatch" error.

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