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

    https://github.com/apache/spark/pull/1107#discussion_r13908816
  
    --- Diff: 
core/src/main/scala/org/apache/spark/network/ConnectionManager.scala ---
    @@ -102,7 +102,24 @@ private[spark] class ConnectionManager(port: Int, 
conf: SparkConf,
       serverChannel.socket.setReuseAddress(true)
       serverChannel.socket.setReceiveBufferSize(256 * 1024)
     
    -  serverChannel.socket.bind(new InetSocketAddress(port))
    +  def bindWithIncrement(port: Int, maxTries: Int = 3) {
    +    for( offset <- 0 until maxTries ) {
    +      try {
    +        serverChannel.socket.bind(new InetSocketAddress(port + offset))
    +        return
    --- End diff --
    
    Something is required to stop looping after a success, right? `break` might 
be clearer if Scala had it; `return` might just be simpler than using 
`breakable`. Or some kind of success flag with a while loop.


---
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.
---

Reply via email to