Skip to content

Commit 8ac0369

Browse files
author
chie8842
committed
added configuration
1 parent 955a82c commit 8ac0369

File tree

2 files changed

+22
-31
lines changed

2 files changed

+22
-31
lines changed

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

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -310,38 +310,27 @@ private[spark] object JettyUtils extends Logging {
310310
// If the new port wraps around, do not try a privileged port.
311311

312312
require(sslOptions.port == 0 || (1024 <= sslOptions.port && sslOptions.port < 65536))
313-
val maxRetries = Utils.portMaxRetries(conf)
314313

315-
val scheme = "https"
316-
// Create a connector on port securePort to listen for HTTPS requests
317-
var offset = 0
318-
var connected = false
319-
while (offset < maxRetries && connected == false) {
320-
val securePort =
321-
if (currentPort != 0) {
322-
if (1024 < sslOptions.port && sslOptions.port < 65536) {
323-
sslOptions.port + offset
324-
} else {
325-
(currentPort + 400 - 1024) % (65536 - 1024) + 1024
326-
}
314+
val securePort =
315+
if (currentPort != 0) {
316+
if (1024 < sslOptions.port && sslOptions.port < 65536) {
317+
sslOptions.port
327318
} else {
328-
0
319+
(currentPort + 400 - 1024) % (65536 - 1024) + 1024
329320
}
330-
val connector = new ServerConnector(server, factory)
331-
connector.setPort(securePort)
332-
connectors += connector
333-
try{
334-
// redirect the HTTP requests to HTTPS port
335-
collection.addHandler(createRedirectHttpsHandler(securePort, scheme))
336-
connected = true
337-
} catch {
338-
case e: Exception =>
339-
if (offset >= maxRetries) {
340-
throw e
341-
}
321+
} else {
322+
0
342323
}
343-
offset += 1
344-
}
324+
val scheme = "https"
325+
// Create a connector on port securePort to listen for HTTPS requestswork.
326+
327+
val connector = new ServerConnector(server, factory)
328+
connector.setPort(securePort)
329+
330+
connectors += connector
331+
332+
// redirect the HTTP requests to HTTPS port
333+
collection.addHandler(createRedirectHttpsHandler(securePort, scheme))
345334
}
346335

347336
gzipHandlers.foreach(collection.addHandler)

docs/configuration.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,10 +1664,12 @@ Apart from these, the following properties are also available, and may be useful
16641664
</td>
16651665
</tr>
16661666
<tr>
1667-
<td><code>spark.ssl.port</code></td>
1668-
<td>None</td>
1667+
<td><code>spark.ssl.<particular protocol>.port</code></td>
1668+
<td>0</td>
16691669
<td>
1670-
A port number hen connecting with SSL.
1670+
A port number hen connecting with SSL. Default value 0 means to be determined automatically.
1671+
Attention that the port should be separated for each particular protocol.
1672+
Not configure as <code>spark.ssl.port<code> but configure <code>spark.ssl.<particular protocol>.port<code>.
16711673
</td>
16721674
</tr>
16731675
<tr>

0 commit comments

Comments
 (0)