aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorShivaram Venkataraman <shivaram@eecs.berkeley.edu>2013-05-31 23:32:18 -0700
committerShivaram Venkataraman <shivaram@eecs.berkeley.edu>2013-05-31 23:32:18 -0700
commit038cfc1a9acb32f8c17d883ea64f8cbb324ed82c (patch)
treec37b2dedda2a46a723ddd41782a6a468145a80d7 /core/src
parent91aca9224936da84b16ea789cb81914579a0db03 (diff)
downloadspark-038cfc1a9acb32f8c17d883ea64f8cbb324ed82c.tar.gz
spark-038cfc1a9acb32f8c17d883ea64f8cbb324ed82c.tar.bz2
spark-038cfc1a9acb32f8c17d883ea64f8cbb324ed82c.zip
Make connect timeout configurable
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/java/spark/network/netty/FileClient.java6
-rw-r--r--core/src/main/scala/spark/network/netty/ShuffleCopier.scala3
2 files changed, 6 insertions, 3 deletions
diff --git a/core/src/main/java/spark/network/netty/FileClient.java b/core/src/main/java/spark/network/netty/FileClient.java
index 9c9b976ebe..517772202f 100644
--- a/core/src/main/java/spark/network/netty/FileClient.java
+++ b/core/src/main/java/spark/network/netty/FileClient.java
@@ -17,9 +17,11 @@ class FileClient {
private FileClientHandler handler = null;
private Channel channel = null;
private Bootstrap bootstrap = null;
+ private int connectTimeout = 60*1000; // 1 min
- public FileClient(FileClientHandler handler) {
+ public FileClient(FileClientHandler handler, int connectTimeout) {
this.handler = handler;
+ this.connectTimeout = connectTimeout;
}
public void init() {
@@ -28,7 +30,7 @@ class FileClient {
.channel(OioSocketChannel.class)
.option(ChannelOption.SO_KEEPALIVE, true)
.option(ChannelOption.TCP_NODELAY, true)
- .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 0) // Disable connect timeout
+ .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, connectTimeout) // Disable connect timeout
.handler(new FileClientChannelInitializer(handler));
}
diff --git a/core/src/main/scala/spark/network/netty/ShuffleCopier.scala b/core/src/main/scala/spark/network/netty/ShuffleCopier.scala
index 8ec46d42fa..afb2cdbb3a 100644
--- a/core/src/main/scala/spark/network/netty/ShuffleCopier.scala
+++ b/core/src/main/scala/spark/network/netty/ShuffleCopier.scala
@@ -18,7 +18,8 @@ private[spark] class ShuffleCopier extends Logging {
resultCollectCallback: (String, Long, ByteBuf) => Unit) {
val handler = new ShuffleCopier.ShuffleClientHandler(resultCollectCallback)
- val fc = new FileClient(handler)
+ val fc = new FileClient(handler,
+ System.getProperty("spark.shuffle.netty.connect.timeout", "60000").toInt)
try {
fc.init()
fc.connect(host, port)