Skip to content

Commit e72966e

Browse files
committed
removed check for null value.
1 parent 95d31f6 commit e72966e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

core/src/main/scala/org/apache/spark/executor/ExecutorSource.scala

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,8 @@ class ExecutorSource(threadPool: ThreadPoolExecutor, executorId: String) extends
8686
val name = new ObjectName("java.lang", "type", "OperatingSystem")
8787
override def getValue: Long = {
8888
try {
89-
val attribute = mBean.getAttribute(name, "ProcessCpuTime")
90-
if (attribute != null) {
91-
attribute.asInstanceOf[Long]
92-
} else {
93-
-1L
94-
}
89+
// return JVM process CPU time if the ProcessCpuTime method is available
90+
mBean.getAttribute(name, "ProcessCpuTime").asInstanceOf[Long]
9591
} catch {
9692
case NonFatal(_) => -1L
9793
}

0 commit comments

Comments
 (0)