|
@@ -36,8 +36,6 @@ import java.util.StringTokenizer;
|
|
|
|
|
|
import javax.ws.rs.core.MediaType;
|
|
|
|
|
|
-import org.apache.commons.logging.Log;
|
|
|
-import org.apache.commons.logging.LogFactory;
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
import org.apache.hadoop.fs.BlockLocation;
|
|
|
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
|
@@ -81,6 +79,8 @@ import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSelect
|
|
|
import org.apache.hadoop.util.Progressable;
|
|
|
import org.apache.hadoop.util.StringUtils;
|
|
|
import org.codehaus.jackson.map.ObjectMapper;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import com.google.common.annotations.VisibleForTesting;
|
|
|
import com.google.common.base.Preconditions;
|
|
@@ -89,7 +89,8 @@ import com.google.common.collect.Lists;
|
|
|
/** A FileSystem for HDFS over the web. */
|
|
|
public class WebHdfsFileSystem extends FileSystem
|
|
|
implements DelegationTokenRenewer.Renewable, TokenAspect.TokenManagementDelegator {
|
|
|
- public static final Log LOG = LogFactory.getLog(WebHdfsFileSystem.class);
|
|
|
+ public static final Logger LOG = LoggerFactory
|
|
|
+ .getLogger(WebHdfsFileSystem.class);
|
|
|
/** WebHdfs version. */
|
|
|
public static final int VERSION = 1;
|
|
|
/** Http URI: http://namenode:port/{PATH_PREFIX}/path/to/file */
|
|
@@ -221,14 +222,14 @@ public class WebHdfsFileSystem extends FileSystem
|
|
|
// to get another token to match hdfs/rpc behavior
|
|
|
if (token != null) {
|
|
|
if(LOG.isDebugEnabled()) {
|
|
|
- LOG.debug("Using UGI token: " + token);
|
|
|
+ LOG.debug("Using UGI token: {}", token);
|
|
|
}
|
|
|
canRefreshDelegationToken = false;
|
|
|
} else {
|
|
|
token = getDelegationToken(null);
|
|
|
if (token != null) {
|
|
|
if(LOG.isDebugEnabled()) {
|
|
|
- LOG.debug("Fetched new token: " + token);
|
|
|
+ LOG.debug("Fetched new token: {}", token);
|
|
|
}
|
|
|
} else { // security is disabled
|
|
|
canRefreshDelegationToken = false;
|
|
@@ -245,7 +246,7 @@ public class WebHdfsFileSystem extends FileSystem
|
|
|
if (canRefreshDelegationToken) {
|
|
|
Token<?> token = getDelegationToken(null);
|
|
|
if(LOG.isDebugEnabled()) {
|
|
|
- LOG.debug("Replaced expired token: " + token);
|
|
|
+ LOG.debug("Replaced expired token: {}", token);
|
|
|
}
|
|
|
setDelegationToken(token);
|
|
|
replaced = (token != null);
|
|
@@ -430,7 +431,7 @@ public class WebHdfsFileSystem extends FileSystem
|
|
|
final URL url = new URL(getTransportScheme(), nnAddr.getHostName(),
|
|
|
nnAddr.getPort(), path + '?' + query);
|
|
|
if (LOG.isTraceEnabled()) {
|
|
|
- LOG.trace("url=" + url);
|
|
|
+ LOG.trace("url={}", url);
|
|
|
}
|
|
|
return url;
|
|
|
}
|
|
@@ -467,7 +468,7 @@ public class WebHdfsFileSystem extends FileSystem
|
|
|
+ Param.toSortedString("&", parameters);
|
|
|
final URL url = getNamenodeURL(path, query);
|
|
|
if (LOG.isTraceEnabled()) {
|
|
|
- LOG.trace("url=" + url);
|
|
|
+ LOG.trace("url={}", url);
|
|
|
}
|
|
|
return url;
|
|
|
}
|
|
@@ -658,9 +659,9 @@ public class WebHdfsFileSystem extends FileSystem
|
|
|
a.action == RetryPolicy.RetryAction.RetryDecision.FAILOVER_AND_RETRY;
|
|
|
|
|
|
if (isRetry || isFailoverAndRetry) {
|
|
|
- LOG.info("Retrying connect to namenode: " + nnAddr
|
|
|
- + ". Already tried " + retry + " time(s); retry policy is "
|
|
|
- + retryPolicy + ", delay " + a.delayMillis + "ms.");
|
|
|
+ LOG.info("Retrying connect to namenode: {}. Already tried {}"
|
|
|
+ + " time(s); retry policy is {}, delay {}ms.", nnAddr, retry,
|
|
|
+ retryPolicy, a.delayMillis);
|
|
|
|
|
|
if (isFailoverAndRetry) {
|
|
|
resetStateToFailOver();
|
|
@@ -757,7 +758,7 @@ public class WebHdfsFileSystem extends FileSystem
|
|
|
final IOException ioe =
|
|
|
new IOException("Response decoding failure: "+e.toString(), e);
|
|
|
if (LOG.isDebugEnabled()) {
|
|
|
- LOG.debug(ioe);
|
|
|
+ LOG.debug("Response decoding failure: {}", e.toString(), e);
|
|
|
}
|
|
|
throw ioe;
|
|
|
} finally {
|
|
@@ -1212,7 +1213,7 @@ public class WebHdfsFileSystem extends FileSystem
|
|
|
}
|
|
|
} catch (IOException ioe) {
|
|
|
if (LOG.isDebugEnabled()) {
|
|
|
- LOG.debug("Token cancel failed: " + ioe);
|
|
|
+ LOG.debug("Token cancel failed: ", ioe);
|
|
|
}
|
|
|
} finally {
|
|
|
super.close();
|