File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
core/src/main/scala/org/apache/spark/scheduler Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -131,20 +131,19 @@ private[spark] class LiveListenerBus(val sparkContext: SparkContext) extends Spa
131131 onDropEvent(event)
132132 droppedEventsCounter.incrementAndGet()
133133 }
134- // Don't log too frequently
135- if (System .currentTimeMillis() - lastReportTimestamp >= 60 * 1000 ) {
136- var droppedEvents = droppedEventsCounter.get
137- while (droppedEvents > 0 ) {
134+
135+ val droppedEvents = droppedEventsCounter.get
136+ if (droppedEvents > 0 ) {
137+ // Don't log too frequently
138+ if (System .currentTimeMillis() - lastReportTimestamp >= 60 * 1000 ) {
138139 // There may be multiple threads trying to decrease droppedEventsCounter.
139140 // Use "compareAndSet" to make sure only one thread can win.
140- // And if another thread is increasing droppedEventsCounter, "compareAndSet" will fail
141- // and we will try again .
141+ // And if another thread is increasing droppedEventsCounter, "compareAndSet" will fail and
142+ // then that thread will update it .
142143 if (droppedEventsCounter.compareAndSet(droppedEvents, 0 )) {
143144 lastReportTimestamp = System .currentTimeMillis()
144145 logWarning(s " Dropped $droppedEvents SparkListenerEvents " )
145- return
146146 }
147- droppedEvents = droppedEventsCounter.get
148147 }
149148 }
150149 }
You can’t perform that action at this time.
0 commit comments