Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewor14 committed Aug 6, 2014
1 parent c22ad00 commit b97b02a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion core/src/main/scala/org/apache/spark/HttpServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private[spark] class HttpServer(
private def doStart(startPort: Int): (Server, Int) = {
val server = new Server()
val connector = new SocketConnector
connector.setMaxIdleTime(60*1000)
connector.setMaxIdleTime(60 * 1000)
connector.setSoLingerTime(-1)
connector.setPort(startPort)
server.addConnector(connector)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ private[spark] class ConnectionManager(
port: Int,
conf: SparkConf,
securityManager: SecurityManager,
name: String = "Connection manager") extends Logging {
name: String = "Connection manager")
extends Logging {

class MessageStatus(
val message: Message,
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/scala/org/apache/spark/ui/JettyUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ private[spark] object JettyUtils extends Logging {
}
}

val (server, boundPort) =
Utils.startServiceOnPort[Server](port, connect, serverName, maxRetries = 10)
val (server, boundPort) = Utils.startServiceOnPort[Server](port, connect, serverName)
ServerInfo(server, boundPort, collection)
}

Expand Down
7 changes: 3 additions & 4 deletions core/src/main/scala/org/apache/spark/util/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1344,14 +1344,13 @@ private[spark] object Utils extends Logging {

/**
* Attempt to start a service on the given port, or fail after a number of attempts.
* Each subsequent attempt uses 1 + the port used in the previous attempt.
* Each subsequent attempt uses 1 + the port used in the previous attempt (unless the port is 0).
*
* @param startPort The initial port to start the service on.
* @param maxRetries Maximum number of retries to attempt.
* A value of 3 means attempting ports n, n+1, n+2, and n+3, for example.
* @param startService Function to start service on a given port.
* This is expected to throw java.net.BindException on port collision.
* @throws SparkException When unable to start the service after a given number of attempts
*/
def startServiceOnPort[T](
startPort: Int,
Expand Down Expand Up @@ -1381,13 +1380,13 @@ private[spark] object Utils extends Logging {
}
}
// Should never happen
throw new SparkException(s"Failed to start service on port $startPort")
throw new SparkException(s"Failed to start service$serviceString on port $startPort")
}

/**
* Return whether the exception is caused by an address-port collision when binding.
*/
private def isBindCollision(exception: Throwable): Boolean = {
def isBindCollision(exception: Throwable): Boolean = {
exception match {
case e: BindException =>
if (e.getMessage != null && e.getMessage.contains("Address already in use")) {
Expand Down

0 comments on commit b97b02a

Please sign in to comment.