Skip to content
Snippets Groups Projects
Commit 7bb12a2a authored by Reynold Xin's avatar Reynold Xin
Browse files

Merge pull request #940 from ankurdave/clear-port-properties-after-tests

After unit tests, clear port properties unconditionally
parents cd7222c3 026dba6a
No related branches found
No related tags found
No related merge requests found
......@@ -40,17 +40,17 @@ trait LocalSparkContext extends BeforeAndAfterEach with BeforeAndAfterAll { self
}
def resetSparkContext() = {
if (sc != null) {
LocalSparkContext.stop(sc)
sc = null
}
LocalSparkContext.stop(sc)
sc = null
}
}
object LocalSparkContext {
def stop(sc: SparkContext) {
sc.stop()
if (sc != null) {
sc.stop()
}
// To avoid Akka rebinding to the same port, since it doesn't unbind immediately on shutdown
System.clearProperty("spark.driver.port")
System.clearProperty("spark.hostPort")
......
......@@ -33,10 +33,8 @@ trait SharedSparkContext extends BeforeAndAfterAll { self: Suite =>
}
override def afterAll() {
if (_sc != null) {
LocalSparkContext.stop(_sc)
_sc = null
}
LocalSparkContext.stop(_sc)
_sc = null
super.afterAll()
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment