HADOOP-12901. Add warning log when KMSClientProvider cannot create a connection to the KMS server. (Xiao Chen via wang)
(cherry picked from commit391da36d93
) (cherry picked from commitfed2339e28
)
This commit is contained in:
parent
02949b2151
commit
352d5a7e88
|
@ -42,6 +42,8 @@ import org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthentica
|
||||||
import org.apache.hadoop.util.HttpExceptionUtils;
|
import org.apache.hadoop.util.HttpExceptionUtils;
|
||||||
import org.apache.http.client.utils.URIBuilder;
|
import org.apache.http.client.utils.URIBuilder;
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import org.codehaus.jackson.map.ObjectMapper;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
|
||||||
|
@ -85,6 +87,9 @@ import com.google.common.base.Strings;
|
||||||
public class KMSClientProvider extends KeyProvider implements CryptoExtension,
|
public class KMSClientProvider extends KeyProvider implements CryptoExtension,
|
||||||
KeyProviderDelegationTokenExtension.DelegationTokenExtension {
|
KeyProviderDelegationTokenExtension.DelegationTokenExtension {
|
||||||
|
|
||||||
|
private static final Logger LOG =
|
||||||
|
LoggerFactory.getLogger(KMSClientProvider.class);
|
||||||
|
|
||||||
private static final String INVALID_SIGNATURE = "Invalid signature";
|
private static final String INVALID_SIGNATURE = "Invalid signature";
|
||||||
|
|
||||||
private static final String ANONYMOUS_REQUESTS_DISALLOWED = "Anonymous requests are disallowed";
|
private static final String ANONYMOUS_REQUESTS_DISALLOWED = "Anonymous requests are disallowed";
|
||||||
|
@ -491,6 +496,9 @@ public class KMSClientProvider extends KeyProvider implements CryptoExtension,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
|
if (ex instanceof SocketTimeoutException) {
|
||||||
|
LOG.warn("Failed to connect to {}:{}", url.getHost(), url.getPort());
|
||||||
|
}
|
||||||
throw ex;
|
throw ex;
|
||||||
} catch (UndeclaredThrowableException ex) {
|
} catch (UndeclaredThrowableException ex) {
|
||||||
throw new IOException(ex.getUndeclaredThrowable());
|
throw new IOException(ex.getUndeclaredThrowable());
|
||||||
|
|
Loading…
Reference in New Issue