Github user vanzin commented on the pull request: https://github.com/apache/spark/pull/4525#issuecomment-74198732 HI @marsishandsome , I'm suggesting pretty much the same approach, but without using a shared data structure like you're currently doing. Basically, you'd do something like this (in pseudo-scalaish-code): val replayExecutor = Executors.newSingleThreadExecutor() def replay(logs: Seq[FileStatus]): Unit = { val newApps = logs.foreach { /* parse log into app info */ } this.apps merge(this.apps, newApps) } def checkForLogs(): Unit = { val logs = fs.listStatus(path)./* sort, filter, etc */ while (!logs.isEmpty) { val batch = logs.take(20) replayExecutor.submit { () => replay(batch) } } } You don't need a shared data structure to hold the intermediate data, because the execution queue implicitly holds the data. Single it's a single-threaded executor, logs will be parsed in the order defined by `checkForLogs`, so everything should work like currently.
--- 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