Sfoglia il codice sorgente

MAPREDUCE-4860. DelegationTokenRenewal attempts to renew token even after a job is removed. (kkambatl via tucu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1@1421582 13f79535-47bb-0310-9956-ffa450edef68
Alejandro Abdelnur 12 anni fa
parent
commit
6f04a67fcf

+ 3 - 0
CHANGES.txt

@@ -330,6 +330,9 @@ Release 1.2.0 - unreleased
     HADOOP-8164. Handle paths using back slash as path separator for windows
     only. (Daryn Sharp, backported by Jing Zhao via suresh)
 
+    MAPREDUCE-4860. DelegationTokenRenewal attempts to renew token even after
+    a job is removed. (kkambatl via tucu)
+
 Release 1.1.2 - Unreleased
 
   INCOMPATIBLE CHANGES

+ 12 - 1
src/mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java

@@ -200,11 +200,16 @@ public class DelegationTokenRenewal {
    */
   private static class RenewalTimerTask extends TimerTask {
     private DelegationTokenToRenew dttr;
+    private boolean cancelled = false;
     
     RenewalTimerTask(DelegationTokenToRenew t) {  dttr = t;  }
     
     @Override
-    public void run() {
+    public synchronized void run() {
+      if (cancelled) {
+        return;
+      }
+
       Token<?> token = dttr.token;
       try {
         // need to use doAs so that http can find the kerberos tgt
@@ -227,6 +232,12 @@ public class DelegationTokenRenewal {
         removeFailedDelegationToken(dttr);
       }
     }
+
+    @Override
+    public synchronized boolean cancel() {
+      cancelled = true;
+      return super.cancel();
+    }
   }
   
   /**