Make connect timeout configurable
This commit is contained in:
parent
91aca92249
commit
038cfc1a9a
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue