@@ -174,16 +174,20 @@ private[spark] object CoarseGrainedExecutorBackend extends Logging {
174174 // Can't use Option[ExecutorDelegationTokenUpdater] because it is built only in YARN
175175 // profile, so use Option[Any] since even the stop method call will be via reflection.
176176 var tokenUpdaterOption : Option [Any ] = None
177- val tokenUpdaterClass =
178- Class .forName(" org.apache.spark.deploy.yarn.ExecutorDelegationTokenUpdater" )
177+ var tokenUpdaterClass : Option [Class [_]] = None
179178 if (driverConf.contains(" spark.yarn.credentials.file" )) {
180179 logInfo(" Will periodically update credentials from: " +
181180 driverConf.get(" spark.yarn.credentials.file" ))
181+
182+ tokenUpdaterClass =
183+ Some (Class .forName(" org.apache.spark.deploy.yarn.ExecutorDelegationTokenUpdater" ))
184+
182185 // Periodically update the credentials for this user to ensure HDFS tokens get updated.
183186 val constructor =
184- tokenUpdaterClass.getDeclaredConstructor(classOf [SparkConf ], classOf [Configuration ])
187+ tokenUpdaterClass.get. getDeclaredConstructor(classOf [SparkConf ], classOf [Configuration ])
185188 tokenUpdaterOption = Some (constructor.newInstance(driverConf, SparkHadoopUtil .get.conf))
186- tokenUpdaterClass.getMethod(" updateCredentialsIfRequired" ).invoke(tokenUpdaterOption.get)
189+ tokenUpdaterClass.get.getMethod(" updateCredentialsIfRequired" )
190+ .invoke(tokenUpdaterOption.get)
187191 }
188192
189193 val env = SparkEnv .createExecutorEnv(
@@ -202,7 +206,7 @@ private[spark] object CoarseGrainedExecutorBackend extends Logging {
202206 }
203207 env.rpcEnv.awaitTermination()
204208 if (tokenUpdaterOption.isDefined) {
205- tokenUpdaterClass.getMethod(" stop" ).invoke(tokenUpdaterOption.get)
209+ tokenUpdaterClass.get. getMethod(" stop" ).invoke(tokenUpdaterOption.get)
206210 }
207211 }
208212 }
0 commit comments