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_r290514760
##########
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:
Ah, yes, it can be removed here. I thought that Scala functions didn't work
cleanly with Java classes, but it's not a problem here. I think there are still
some places other where JavaOptionals might be useful, since sometimes it is
nicer to use Scala syntax when in a Scala class.
----------------------------------------------------------------
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