hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1057804 - in /hadoop/common/branches/branch-0.22: CHANGES.txt src/java/org/apache/hadoop/security/UserGroupInformation.java
Date Tue, 11 Jan 2011 19:11:06 GMT
Author: todd
Date: Tue Jan 11 19:11:06 2011
New Revision: 1057804

URL: http://svn.apache.org/viewvc?rev=1057804&view=rev
Log:
HADOOP-7091. reloginFromKeytab() should happen even if TGT can't be found. Contributed by
Kan Zhang

Modified:
    hadoop/common/branches/branch-0.22/CHANGES.txt
    hadoop/common/branches/branch-0.22/src/java/org/apache/hadoop/security/UserGroupInformation.java

Modified: hadoop/common/branches/branch-0.22/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/CHANGES.txt?rev=1057804&r1=1057803&r2=1057804&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.22/CHANGES.txt Tue Jan 11 19:11:06 2011
@@ -368,6 +368,9 @@ Release 0.22.0 - Unreleased
 
     HADOOP-7087. SequenceFile.createWriter ignores FileSystem parameter (todd)
 
+    HADOOP-7091. reloginFromKeytab() should happen even if TGT can't be found.
+    (Kan Zhang via todd)
+
 Release 0.21.1 - Unreleased
 
   IMPROVEMENTS

Modified: hadoop/common/branches/branch-0.22/src/java/org/apache/hadoop/security/UserGroupInformation.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/src/java/org/apache/hadoop/security/UserGroupInformation.java?rev=1057804&r1=1057803&r2=1057804&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/src/java/org/apache/hadoop/security/UserGroupInformation.java
(original)
+++ hadoop/common/branches/branch-0.22/src/java/org/apache/hadoop/security/UserGroupInformation.java
Tue Jan 11 19:11:06 2011
@@ -526,7 +526,7 @@ public class UserGroupInformation {
    * Get the Kerberos TGT
    * @return the user's TGT or null if none was found
    */
-  private KerberosTicket getTGT() {
+  private synchronized KerberosTicket getTGT() {
     Set<KerberosTicket> tickets = subject
         .getPrivateCredentials(KerberosTicket.class);
     for (KerberosTicket ticket : tickets) {
@@ -657,12 +657,14 @@ public class UserGroupInformation {
          !isKeytab)
       return;
     
-    KerberosTicket tgt = getTGT();
-    if (tgt == null) {
+    long now = System.currentTimeMillis();
+    if (!hasSufficientTimeElapsed(now)) {
       return;
     }
+
+    KerberosTicket tgt = getTGT();
     //Return if TGT is valid and is not going to expire soon.
-    if (System.currentTimeMillis() < getRefreshTime(tgt)) {
+    if (tgt != null && now < getRefreshTime(tgt)) {
       return;
     }
     
@@ -670,7 +672,6 @@ public class UserGroupInformation {
     if (login == null || keytabFile == null) {
       throw new IOException("loginUserFromKeyTab must be done first");
     }
-    long now = System.currentTimeMillis();
     
     long start = 0;
     // register most recent relogin attempt



Mime
View raw message