hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1406810 - in /hadoop/common/branches/branch-1: CHANGES.txt src/mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java src/test/org/apache/hadoop/mapreduce/security/token/TestDelegationTokenRenewal.java
Date Wed, 07 Nov 2012 21:13:11 GMT
Author: tucu
Date: Wed Nov  7 21:13:11 2012
New Revision: 1406810

URL: http://svn.apache.org/viewvc?rev=1406810&view=rev
Log:
MAPREDUCE-4765. Restarting the JobTracker programmatically can cause DelegationTokenRenewal
to throw an exception. (rkanter via tucu)

Modified:
    hadoop/common/branches/branch-1/CHANGES.txt
    hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java
    hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapreduce/security/token/TestDelegationTokenRenewal.java

Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1406810&r1=1406809&r2=1406810&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Wed Nov  7 21:13:11 2012
@@ -311,6 +311,9 @@ Release 1.2.0 - unreleased
     directory deletion completes. It allows other operations when the 
     deletion is in progress. (umamahesh via suresh)
 
+    MAPREDUCE-4765. Restarting the JobTracker programmatically can cause
+    DelegationTokenRenewal to throw an exception. (rkanter via tucu)
+
 Release 1.1.1 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java?rev=1406810&r1=1406809&r2=1406810&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java
(original)
+++ hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapreduce/security/token/DelegationTokenRenewal.java
Wed Nov  7 21:13:11 2012
@@ -89,7 +89,7 @@ public class DelegationTokenRenewal {
   }
   
   // global single timer (daemon)
-  private static Timer renewalTimer = new Timer(true);
+  private static Timer renewalTimer = null;
   
   //delegation token canceler thread
   private static DelegationTokenCancelThread dtCancelThread =
@@ -232,7 +232,7 @@ public class DelegationTokenRenewal {
   /**
    * set task to renew the token
    */
-  private static 
+  private static synchronized
   void setTimerForTokenRenewal(DelegationTokenToRenew token, 
                                boolean firstTime) throws IOException {
       
@@ -250,14 +250,20 @@ public class DelegationTokenRenewal {
     TimerTask tTask = new RenewalTimerTask(token);
     token.setTimerTask(tTask); // keep reference to the timer
 
+    if (renewalTimer == null) {
+        renewalTimer = new Timer(true);
+    }
     renewalTimer.schedule(token.timerTask, new Date(renewIn));
   }
 
   /**
    * removing all tokens renewals
    */
-  static public void close() {
-    renewalTimer.cancel();
+  public static synchronized void close() {
+    if (renewalTimer != null) {
+        renewalTimer.cancel();
+    }
+    renewalTimer = null;
     delegationTokens.clear();
   }
   

Modified: hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapreduce/security/token/TestDelegationTokenRenewal.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapreduce/security/token/TestDelegationTokenRenewal.java?rev=1406810&r1=1406809&r2=1406810&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapreduce/security/token/TestDelegationTokenRenewal.java
(original)
+++ hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapreduce/security/token/TestDelegationTokenRenewal.java
Wed Nov  7 21:13:11 2012
@@ -354,4 +354,19 @@ public class TestDelegationTokenRenewal 
       //expected
     }
   }
+
+  /**
+   * Run the testDTRenewal(), close the DelegationTokenRenewal, and run the
+   * testDTRenewal() test again to make sure that DelegationTokenRenewal can be
+   * re-used after its been closed
+   * @throws Exception
+   */
+  @Test
+  public void testDTRenewalAfterClose() throws Exception {
+      Renewer.counter = 0;
+      testDTRenewal();
+      DelegationTokenRenewal.close();
+      Renewer.counter = 0;
+      testDTRenewal();
+  }
 }



Mime
View raw message