Skip to content

Commit b97b02a

Browse files
committed
Minor fixes
1 parent c22ad00 commit b97b02a

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

core/src/main/scala/org/apache/spark/HttpServer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private[spark] class HttpServer(
7272
private def doStart(startPort: Int): (Server, Int) = {
7373
val server = new Server()
7474
val connector = new SocketConnector
75-
connector.setMaxIdleTime(60*1000)
75+
connector.setMaxIdleTime(60 * 1000)
7676
connector.setSoLingerTime(-1)
7777
connector.setPort(startPort)
7878
server.addConnector(connector)

core/src/main/scala/org/apache/spark/network/ConnectionManager.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ private[spark] class ConnectionManager(
4242
port: Int,
4343
conf: SparkConf,
4444
securityManager: SecurityManager,
45-
name: String = "Connection manager") extends Logging {
45+
name: String = "Connection manager")
46+
extends Logging {
4647

4748
class MessageStatus(
4849
val message: Message,

core/src/main/scala/org/apache/spark/ui/JettyUtils.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ private[spark] object JettyUtils extends Logging {
199199
}
200200
}
201201

202-
val (server, boundPort) =
203-
Utils.startServiceOnPort[Server](port, connect, serverName, maxRetries = 10)
202+
val (server, boundPort) = Utils.startServiceOnPort[Server](port, connect, serverName)
204203
ServerInfo(server, boundPort, collection)
205204
}
206205

core/src/main/scala/org/apache/spark/util/Utils.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,14 +1344,13 @@ private[spark] object Utils extends Logging {
13441344

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

13871386
/**
13881387
* Return whether the exception is caused by an address-port collision when binding.
13891388
*/
1390-
private def isBindCollision(exception: Throwable): Boolean = {
1389+
def isBindCollision(exception: Throwable): Boolean = {
13911390
exception match {
13921391
case e: BindException =>
13931392
if (e.getMessage != null && e.getMessage.contains("Address already in use")) {

0 commit comments

Comments
 (0)