From 01a407d9df0e9d05bc4ce0699de566cbadc6a869 Mon Sep 17 00:00:00 2001 From: Matthew Foley Date: Thu, 16 Jun 2011 19:04:26 +0000 Subject: [PATCH] HDFS-1656. Fixes an issue to do with fetching of delegation tokens in HftpFileSystem. Contributed by Kan Zhang. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1136608 13f79535-47bb-0310-9956-ffa450edef68 --- hdfs/CHANGES.txt | 3 +++ hdfs/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hdfs/CHANGES.txt b/hdfs/CHANGES.txt index a2613489dc..d2ece0c508 100644 --- a/hdfs/CHANGES.txt +++ b/hdfs/CHANGES.txt @@ -746,6 +746,9 @@ Trunk (unreleased changes) HDFS-1942. Datanode must exist when all the block pool service threads exit. (Bharath Mundlapudi via suresh) + HDFS-1656. Fixes an issue to do with fetching of delegation tokens in + HftpFileSystem. Contributed by Kan Zhang. + Release 0.22.0 - Unreleased INCOMPATIBLE CHANGES diff --git a/hdfs/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java b/hdfs/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java index bcc7426f78..684d8e8a39 100644 --- a/hdfs/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java +++ b/hdfs/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java @@ -190,9 +190,6 @@ public void initialize(final URI name, final Configuration conf) } } - //Renew TGT if needed - ugi.reloginFromKeytab(); - //since we don't already have a token, go get one over https if (delegationToken == null) { delegationToken = @@ -204,8 +201,10 @@ public void initialize(final URI name, final Configuration conf) @Override - public Token getDelegationToken(final String renewer) throws IOException { + public synchronized Token getDelegationToken(final String renewer) throws IOException { try { + //Renew TGT if needed + ugi.reloginFromKeytab(); return ugi.doAs(new PrivilegedExceptionAction>() { public Token run() throws IOException { Credentials c;