HADOOP-12901. Add warning log when KMSClientProvider cannot create a connection to the KMS server. (Xiao Chen via wang)

(cherry picked from commit 391da36d93)
This commit is contained in:
Andrew Wang 2016-03-07 14:00:02 -08:00
parent 3e987446e3
commit fed2339e28
1 changed files with 8 additions and 0 deletions

View File

@ -42,6 +42,8 @@
import org.apache.hadoop.util.HttpExceptionUtils;
import org.apache.http.client.utils.URIBuilder;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.net.ssl.HttpsURLConnection;
@ -85,6 +87,9 @@
public class KMSClientProvider extends KeyProvider implements CryptoExtension,
KeyProviderDelegationTokenExtension.DelegationTokenExtension {
private static final Logger LOG =
LoggerFactory.getLogger(KMSClientProvider.class);
private static final String INVALID_SIGNATURE = "Invalid signature";
private static final String ANONYMOUS_REQUESTS_DISALLOWED = "Anonymous requests are disallowed";
@ -491,6 +496,9 @@ public HttpURLConnection run() throws Exception {
}
});
} catch (IOException ex) {
if (ex instanceof SocketTimeoutException) {
LOG.warn("Failed to connect to {}:{}", url.getHost(), url.getPort());
}
throw ex;
} catch (UndeclaredThrowableException ex) {
throw new IOException(ex.getUndeclaredThrowable());