mridulm commented on code in PR #44616:
URL: https://github.com/apache/spark/pull/44616#discussion_r1452860600
##########
core/src/main/scala/org/apache/spark/deploy/master/Master.scala:
##########
@@ -58,7 +59,10 @@ private[deploy] class Master(
private val appIdPattern = conf.get(APP_ID_PATTERN)
// For application IDs
- private def createDateFormat = new SimpleDateFormat("yyyyMMddHHmmss",
Locale.US)
+ private lazy val dateTimeFormatter =
Review Comment:
nit: Does not need to be `lazy` and can be moved to `object Master`, same in
other places as well.
##########
core/src/main/scala/org/apache/spark/rdd/NewHadoopRDD.scala:
##########
@@ -103,10 +104,13 @@ class NewHadoopRDD[K, V](
private val confBroadcast = sc.broadcast(new
SerializableConfiguration(_conf))
// private val serializableConf = new SerializableWritable(_conf)
- private val jobTrackerId: String = {
- val formatter = new SimpleDateFormat("yyyyMMddHHmmss", Locale.US)
- formatter.format(new Date())
- }
+ @transient
+ private val dateTimeFormatter =
+ DateTimeFormatter
+ .ofPattern("yyyyMMddHHmmss", Locale.US)
+ .withZone(ZoneId.systemDefault())
+
+ private val jobTrackerId: String = dateTimeFormatter.format(new
Date().toInstant)
Review Comment:
We dont need this field
```suggestion
private val jobTrackerId: String = {
val dateTimeFormatter =
DateTimeFormatter
.ofPattern("yyyyMMddHHmmss", Locale.US)
.withZone(ZoneId.systemDefault())
dateTimeFormatter.format(new Date().toInstant)
}
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]