Github user aarondav commented on a diff in the pull request:

    https://github.com/apache/spark/pull/762#discussion_r12621044
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/Pool.scala ---
    @@ -60,21 +59,21 @@ private[spark] class Pool(
       }
     
       override def addSchedulable(schedulable: Schedulable) {
    -    schedulableQueue += schedulable
    -    schedulableNameToSchedulable(schedulable.name) = schedulable
    +    schedulableQueue.offer(schedulable)
    +    schedulableNameToSchedulable.put(schedulable.name, schedulable)
         schedulable.parent = this
       }
     
       override def removeSchedulable(schedulable: Schedulable) {
    -    schedulableQueue -= schedulable
    -    schedulableNameToSchedulable -= schedulable.name
    +    schedulableQueue.remove(schedulable)
    +    schedulableNameToSchedulable.remove(schedulable.name)
       }
     
       override def getSchedulableByName(schedulableName: String): Schedulable 
= {
    -    if (schedulableNameToSchedulable.contains(schedulableName)) {
    -      return schedulableNameToSchedulable(schedulableName)
    +    if (schedulableNameToSchedulable.containsKey(schedulableName)) {
    +      return schedulableNameToSchedulable.get(schedulableName)
         }
    -    for (schedulable <- schedulableQueue) {
    +    for (schedulable <- schedulableQueue.asScala) {
    --- End diff --
    
    I think ".iterator" might work here, which would be a bit nicer since the 
documentation specifically provides guarantees about it.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to