|
@@ -89,7 +89,7 @@ public class DelegationTokenRenewal {
|
|
}
|
|
}
|
|
|
|
|
|
// global single timer (daemon)
|
|
// global single timer (daemon)
|
|
- private static Timer renewalTimer = new Timer(true);
|
|
|
|
|
|
+ private static Timer renewalTimer = null;
|
|
|
|
|
|
//delegation token canceler thread
|
|
//delegation token canceler thread
|
|
private static DelegationTokenCancelThread dtCancelThread =
|
|
private static DelegationTokenCancelThread dtCancelThread =
|
|
@@ -232,7 +232,7 @@ public class DelegationTokenRenewal {
|
|
/**
|
|
/**
|
|
* set task to renew the token
|
|
* set task to renew the token
|
|
*/
|
|
*/
|
|
- private static
|
|
|
|
|
|
+ private static synchronized
|
|
void setTimerForTokenRenewal(DelegationTokenToRenew token,
|
|
void setTimerForTokenRenewal(DelegationTokenToRenew token,
|
|
boolean firstTime) throws IOException {
|
|
boolean firstTime) throws IOException {
|
|
|
|
|
|
@@ -250,14 +250,20 @@ public class DelegationTokenRenewal {
|
|
TimerTask tTask = new RenewalTimerTask(token);
|
|
TimerTask tTask = new RenewalTimerTask(token);
|
|
token.setTimerTask(tTask); // keep reference to the timer
|
|
token.setTimerTask(tTask); // keep reference to the timer
|
|
|
|
|
|
|
|
+ if (renewalTimer == null) {
|
|
|
|
+ renewalTimer = new Timer(true);
|
|
|
|
+ }
|
|
renewalTimer.schedule(token.timerTask, new Date(renewIn));
|
|
renewalTimer.schedule(token.timerTask, new Date(renewIn));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* removing all tokens renewals
|
|
* removing all tokens renewals
|
|
*/
|
|
*/
|
|
- static public void close() {
|
|
|
|
- renewalTimer.cancel();
|
|
|
|
|
|
+ public static synchronized void close() {
|
|
|
|
+ if (renewalTimer != null) {
|
|
|
|
+ renewalTimer.cancel();
|
|
|
|
+ }
|
|
|
|
+ renewalTimer = null;
|
|
delegationTokens.clear();
|
|
delegationTokens.clear();
|
|
}
|
|
}
|
|
|
|
|