File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
core/src/main/scala/org/apache/spark Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -228,8 +228,12 @@ class SparkContext(
228
228
@ volatile private [spark] var dagScheduler = new DAGScheduler (this )
229
229
dagScheduler.start()
230
230
231
- private [spark] val cleaner = new ContextCleaner (this )
232
- cleaner.start()
231
+ private [spark] val cleaner : Option [ContextCleaner ] =
232
+ if (conf.getBoolean(" spark.cleaner.automatic" , true )) {
233
+ Some (new ContextCleaner (this ))
234
+ } else None
235
+
236
+ cleaner.foreach(_.start())
233
237
234
238
postEnvironmentUpdate()
235
239
@@ -646,7 +650,7 @@ class SparkContext(
646
650
*/
647
651
def broadcast [T ](value : T ): Broadcast [T ] = {
648
652
val bc = env.broadcastManager.newBroadcast[T ](value, isLocal)
649
- cleaner.registerBroadcastForCleanup(bc)
653
+ cleaner.foreach(_. registerBroadcastForCleanup(bc) )
650
654
bc
651
655
}
652
656
@@ -841,7 +845,7 @@ class SparkContext(
841
845
dagScheduler = null
842
846
if (dagSchedulerCopy != null ) {
843
847
metadataCleaner.cancel()
844
- cleaner.stop()
848
+ cleaner.foreach(_. stop() )
845
849
dagSchedulerCopy.stop()
846
850
listenerBus.stop()
847
851
taskScheduler = null
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ import org.apache.spark.scheduler.SchedulingMode.SchedulingMode
42
42
*
43
43
* THREADING: SchedulerBackends and task-submitting clients can call this class from multiple
44
44
* threads, so it needs locks in public API methods to maintain its state. In addition, some
45
- * SchedulerBackends sycnchronize on themselves when they want to send events here, and then
45
+ * SchedulerBackends synchronize on themselves when they want to send events here, and then
46
46
* acquire a lock on us, so we need to make sure that we don't try to lock the backend while
47
47
* we are holding a lock on ourselves.
48
48
*/
You can’t perform that action at this time.
0 commit comments