dongjoon-hyun commented on a change in pull request #35190:
URL: https://github.com/apache/spark/pull/35190#discussion_r784254982
##########
File path: core/src/test/scala/org/apache/spark/SparkFunSuite.scala
##########
@@ -272,19 +272,23 @@ abstract class SparkFunSuite
override def append(loggingEvent: LogEvent): Unit =
loggingEvent.synchronized {
val copyEvent = loggingEvent.toImmutable
if (copyEvent.getLevel.isMoreSpecificThan(_threshold)) {
- if (_loggingEvents.size >= maxEvents) {
- val loggingInfo = if (msg == "") "." else s" while logging $msg."
- throw new IllegalStateException(
- s"Number of events reached the limit of $maxEvents$loggingInfo")
+ _loggingEvents.synchronized {
+ if (_loggingEvents.size >= maxEvents) {
+ val loggingInfo = if (msg == "") "." else s" while logging $msg."
+ throw new IllegalStateException(
+ s"Number of events reached the limit of $maxEvents$loggingInfo")
+ }
+ _loggingEvents.append(copyEvent)
}
- _loggingEvents.append(copyEvent)
}
}
def setThreshold(threshold: Level): Unit = {
_threshold = threshold
}
- def loggingEvents: ArrayBuffer[LogEvent] = _loggingEvents.filterNot(_ ==
null)
+ def loggingEvents: ArrayBuffer[LogEvent] = _loggingEvents.synchronized{
+ _loggingEvents.filterNot(_ == null)
+ }
Review comment:
+1 for @viirya 's comment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]