aboutsummaryrefslogtreecommitdiff
path: root/launcher/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/src/main')
-rw-r--r--launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java b/launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java
index c5fd40816d..d099ee9aa9 100644
--- a/launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java
+++ b/launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java
@@ -242,7 +242,14 @@ class LauncherServer implements Closeable {
synchronized (clients) {
clients.add(clientConnection);
}
- timeoutTimer.schedule(timeout, getConnectionTimeout());
+ long timeoutMs = getConnectionTimeout();
+ // 0 is used for testing to avoid issues with clock resolution / thread scheduling,
+ // and force an immediate timeout.
+ if (timeoutMs > 0) {
+ timeoutTimer.schedule(timeout, getConnectionTimeout());
+ } else {
+ timeout.run();
+ }
}
}
} catch (IOException ioe) {