Skip to content

Commit

Permalink
Revert "[SPARK-23785][LAUNCHER] LauncherBackend doesn't check state o…
Browse files Browse the repository at this point in the history
…f connection before setting state"

This reverts commit 0bfbcaf.
  • Loading branch information
Marcelo Vanzin committed Mar 30, 2018
1 parent 1365d73 commit 3f5955a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ private[spark] abstract class LauncherBackend {
}

def setAppId(appId: String): Unit = {
if (connection != null && isConnected) {
if (connection != null) {
connection.send(new SetAppId(appId))
}
}

def setState(state: SparkAppHandle.State): Unit = {
if (connection != null && isConnected && lastState != state) {
if (connection != null && lastState != state) {
connection.send(new SetState(state))
lastState = state
}
Expand Down Expand Up @@ -114,10 +114,10 @@ private[spark] abstract class LauncherBackend {

override def close(): Unit = {
try {
_isConnected = false
super.close()
} finally {
onDisconnected()
_isConnected = false
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,26 +185,6 @@ public void testStreamFiltering() throws Exception {
}
}

@Test
public void testAppHandleDisconnect() throws Exception {
LauncherServer server = LauncherServer.getOrCreateServer();
ChildProcAppHandle handle = new ChildProcAppHandle(server);
String secret = server.registerHandle(handle);

TestClient client = null;
try {
Socket s = new Socket(InetAddress.getLoopbackAddress(), server.getPort());
client = new TestClient(s);
client.send(new Hello(secret, "1.4.0"));
handle.disconnect();
waitForError(client, secret);
} finally {
handle.kill();
close(client);
client.clientThread.join();
}
}

private void close(Closeable c) {
if (c != null) {
try {
Expand Down

0 comments on commit 3f5955a

Please sign in to comment.