YARN-6294. ATS client should better handle Socket closed case. Contributed by Li Lu.

This commit is contained in:
Junping Du 2017-03-15 11:48:09 -07:00
parent bb6a214cd3
commit 221783b35b

View File

@ -22,6 +22,7 @@
import java.lang.reflect.UndeclaredThrowableException; import java.lang.reflect.UndeclaredThrowableException;
import java.net.ConnectException; import java.net.ConnectException;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.SocketException;
import java.net.SocketTimeoutException; import java.net.SocketTimeoutException;
import java.net.URI; import java.net.URI;
import java.net.URL; import java.net.URL;
@ -390,7 +391,8 @@ public boolean shouldRetryOn(Exception e) {
// Only retry on connection exceptions // Only retry on connection exceptions
return (e instanceof ClientHandlerException) return (e instanceof ClientHandlerException)
&& (e.getCause() instanceof ConnectException && (e.getCause() instanceof ConnectException
|| e.getCause() instanceof SocketTimeoutException); || e.getCause() instanceof SocketTimeoutException
|| e.getCause() instanceof SocketException);
} }
}; };
try { try {