Skip to content

Commit bbbd329

Browse files
author
Andrew Or
committed
Merge branch 'master' of github.com:apache/spark into rest
2 parents 792e112 + e380d2d commit bbbd329

File tree

246 files changed

+16540
-2785
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

246 files changed

+16540
-2785
lines changed

core/pom.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,16 @@
122122
<artifactId>jetty-http</artifactId>
123123
<scope>compile</scope>
124124
</dependency>
125+
<dependency>
126+
<groupId>org.eclipse.jetty</groupId>
127+
<artifactId>jetty-continuation</artifactId>
128+
<scope>compile</scope>
129+
</dependency>
130+
<dependency>
131+
<groupId>org.eclipse.jetty</groupId>
132+
<artifactId>jetty-servlet</artifactId>
133+
<scope>compile</scope>
134+
</dependency>
125135

126136
<dependency>
127137
<groupId>org.apache.commons</groupId>
@@ -385,7 +395,7 @@
385395
<overWriteIfNewer>true</overWriteIfNewer>
386396
<useSubDirectoryPerType>true</useSubDirectoryPerType>
387397
<includeArtifactIds>
388-
guava,jetty-io,jetty-http,jetty-plus,jetty-util,jetty-server
398+
guava,jetty-io,jetty-servlet,jetty-continuation,jetty-http,jetty-plus,jetty-util,jetty-server
389399
</includeArtifactIds>
390400
<silent>true</silent>
391401
</configuration>
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.spark;
19+
20+
import org.apache.spark.scheduler.*;
21+
22+
/**
23+
* Class that allows users to receive all SparkListener events.
24+
* Users should override the onEvent method.
25+
*
26+
* This is a concrete Java class in order to ensure that we don't forget to update it when adding
27+
* new methods to SparkListener: forgetting to add a method will result in a compilation error (if
28+
* this was a concrete Scala class, default implementations of new event handlers would be inherited
29+
* from the SparkListener trait).
30+
*/
31+
public class SparkFirehoseListener implements SparkListener {
32+
33+
public void onEvent(SparkListenerEvent event) { }
34+
35+
@Override
36+
public final void onStageCompleted(SparkListenerStageCompleted stageCompleted) {
37+
onEvent(stageCompleted);
38+
}
39+
40+
@Override
41+
public final void onStageSubmitted(SparkListenerStageSubmitted stageSubmitted) {
42+
onEvent(stageSubmitted);
43+
}
44+
45+
@Override
46+
public final void onTaskStart(SparkListenerTaskStart taskStart) {
47+
onEvent(taskStart);
48+
}
49+
50+
@Override
51+
public final void onTaskGettingResult(SparkListenerTaskGettingResult taskGettingResult) {
52+
onEvent(taskGettingResult);
53+
}
54+
55+
@Override
56+
public final void onTaskEnd(SparkListenerTaskEnd taskEnd) {
57+
onEvent(taskEnd);
58+
}
59+
60+
@Override
61+
public final void onJobStart(SparkListenerJobStart jobStart) {
62+
onEvent(jobStart);
63+
}
64+
65+
@Override
66+
public final void onJobEnd(SparkListenerJobEnd jobEnd) {
67+
onEvent(jobEnd);
68+
}
69+
70+
@Override
71+
public final void onEnvironmentUpdate(SparkListenerEnvironmentUpdate environmentUpdate) {
72+
onEvent(environmentUpdate);
73+
}
74+
75+
@Override
76+
public final void onBlockManagerAdded(SparkListenerBlockManagerAdded blockManagerAdded) {
77+
onEvent(blockManagerAdded);
78+
}
79+
80+
@Override
81+
public final void onBlockManagerRemoved(SparkListenerBlockManagerRemoved blockManagerRemoved) {
82+
onEvent(blockManagerRemoved);
83+
}
84+
85+
@Override
86+
public final void onUnpersistRDD(SparkListenerUnpersistRDD unpersistRDD) {
87+
onEvent(unpersistRDD);
88+
}
89+
90+
@Override
91+
public final void onApplicationStart(SparkListenerApplicationStart applicationStart) {
92+
onEvent(applicationStart);
93+
}
94+
95+
@Override
96+
public final void onApplicationEnd(SparkListenerApplicationEnd applicationEnd) {
97+
onEvent(applicationEnd);
98+
}
99+
100+
@Override
101+
public final void onExecutorMetricsUpdate(
102+
SparkListenerExecutorMetricsUpdate executorMetricsUpdate) {
103+
onEvent(executorMetricsUpdate);
104+
}
105+
106+
@Override
107+
public final void onExecutorAdded(SparkListenerExecutorAdded executorAdded) {
108+
onEvent(executorAdded);
109+
}
110+
111+
@Override
112+
public final void onExecutorRemoved(SparkListenerExecutorRemoved executorRemoved) {
113+
onEvent(executorRemoved);
114+
}
115+
}

core/src/main/java/org/apache/spark/TaskContext.java

Lines changed: 0 additions & 126 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private[spark] class HttpFileServer(
3636
var serverUri : String = null
3737

3838
def initialize() {
39-
baseDir = Utils.createTempDir()
39+
baseDir = Utils.createTempDir(Utils.getLocalDir(conf), "httpd")
4040
fileDir = new File(baseDir, "files")
4141
jarDir = new File(baseDir, "jars")
4242
fileDir.mkdir()

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package org.apache.spark
1919

2020
import java.io.File
2121

22+
import org.eclipse.jetty.server.ssl.SslSocketConnector
2223
import org.eclipse.jetty.util.security.{Constraint, Password}
2324
import org.eclipse.jetty.security.authentication.DigestAuthenticator
2425
import org.eclipse.jetty.security.{ConstraintMapping, ConstraintSecurityHandler, HashLoginService}
@@ -72,7 +73,10 @@ private[spark] class HttpServer(
7273
*/
7374
private def doStart(startPort: Int): (Server, Int) = {
7475
val server = new Server()
75-
val connector = new SocketConnector
76+
77+
val connector = securityManager.fileServerSSLOptions.createJettySslContextFactory()
78+
.map(new SslSocketConnector(_)).getOrElse(new SocketConnector)
79+
7680
connector.setMaxIdleTime(60 * 1000)
7781
connector.setSoLingerTime(-1)
7882
connector.setPort(startPort)
@@ -149,13 +153,14 @@ private[spark] class HttpServer(
149153
}
150154

151155
/**
152-
* Get the URI of this HTTP server (http://host:port)
156+
* Get the URI of this HTTP server (http://host:port or https://host:port)
153157
*/
154158
def uri: String = {
155159
if (server == null) {
156160
throw new ServerStateException("Server is not started")
157161
} else {
158-
"http://" + Utils.localIpAddress + ":" + port
162+
val scheme = if (securityManager.fileServerSSLOptions.enabled) "https" else "http"
163+
s"$scheme://${Utils.localIpAddress}:$port"
159164
}
160165
}
161166
}

0 commit comments

Comments
 (0)