Skip to content

Commit

Permalink
prevent npe
Browse files Browse the repository at this point in the history
  • Loading branch information
turboFei committed Oct 28, 2024
1 parent cbb11f5 commit 78c2a6c
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging {
expireCleanUpTriggerCacheExecutor,
() => {
try {
if (cleanupTerminatedAppInfoTrigger == null) return
cleanupTerminatedAppInfoTrigger.asMap().asScala.foreach {
case (key, _) =>
// do get to trigger cache eviction
Expand Down Expand Up @@ -266,14 +267,23 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging {

if (cleanupTerminatedAppInfoTrigger != null) {
cleanupTerminatedAppInfoTrigger.invalidateAll()
ThreadUtils.shutdown(expireCleanUpTriggerCacheExecutor)
cleanupTerminatedAppInfoTrigger = null
}

kubernetesClients.asScala.foreach { case (_, client) =>
Utils.tryLogNonFatalError(client.close())
}
kubernetesClients.clear()

if (expireCleanUpTriggerCacheExecutor != null) {
ThreadUtils.shutdown(expireCleanUpTriggerCacheExecutor)
expireCleanUpTriggerCacheExecutor = null
}

if (cleanupCanceledAppPodExecutor != null) {
ThreadUtils.shutdown(cleanupCanceledAppPodExecutor)
cleanupCanceledAppPodExecutor = null
}
}

private class SparkEnginePodEventHandler(kubernetesInfo: KubernetesInfo)
Expand Down

0 comments on commit 78c2a6c

Please sign in to comment.