Github user srowen commented on a diff in the pull request: https://github.com/apache/spark/pull/13211#discussion_r64139990 --- Diff: core/src/main/scala/org/apache/spark/util/AccumulatorV2.scala --- @@ -437,7 +438,9 @@ class ListAccumulator[T] extends AccumulatorV2[T, java.util.List[T]] { s"Cannot merge ${this.getClass.getName} with ${other.getClass.getName}") } - override def value: java.util.List[T] = java.util.Collections.unmodifiableList(_list) + override def value: java.util.List[T] = _list.synchronized { + java.util.Collections.unmodifiableList(new ArrayList[T](_list)) --- End diff -- One last thought ... now that this is cloned, does it need to be in an unmodifiable wrapper? maybe it's still a good idea so that the caller doesn't somehow think modifying the list modifies the accumulator
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org