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(
228228 @ volatile private [spark] var dagScheduler = new DAGScheduler (this )
229229 dagScheduler.start()
230230
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())
233237
234238 postEnvironmentUpdate()
235239
@@ -646,7 +650,7 @@ class SparkContext(
646650 */
647651 def broadcast [T ](value : T ): Broadcast [T ] = {
648652 val bc = env.broadcastManager.newBroadcast[T ](value, isLocal)
649- cleaner.registerBroadcastForCleanup(bc)
653+ cleaner.foreach(_. registerBroadcastForCleanup(bc) )
650654 bc
651655 }
652656
@@ -841,7 +845,7 @@ class SparkContext(
841845 dagScheduler = null
842846 if (dagSchedulerCopy != null ) {
843847 metadataCleaner.cancel()
844- cleaner.stop()
848+ cleaner.foreach(_. stop() )
845849 dagSchedulerCopy.stop()
846850 listenerBus.stop()
847851 taskScheduler = null
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ import org.apache.spark.scheduler.SchedulingMode.SchedulingMode
4242 *
4343 * THREADING: SchedulerBackends and task-submitting clients can call this class from multiple
4444 * 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
4646 * acquire a lock on us, so we need to make sure that we don't try to lock the backend while
4747 * we are holding a lock on ourselves.
4848 */
You can’t perform that action at this time.
0 commit comments