@Override public void run() { if (cancelled.get()) { return; } Token<?> token = dttr.token; try { requestNewHdfsDelegationTokenIfNeeded(dttr); // if the token is not replaced by a new token, renew the token if (!dttr.isTimerCancelled()) { renewToken(dttr); setTimerForTokenRenewal(dttr);// set the next one } else { LOG.info("The token was removed already. Token = [" +dttr +"]"); } } catch (Exception e) { LOG.error("Exception renewing token" + token + ". Not rescheduled", e); removeFailedDelegationToken(dttr); } }
@Override public void run() { if (cancelled.get()) { return; } Token<?> token = dttr.token; try { requestNewHdfsDelegationTokenIfNeeded(dttr); // if the token is not replaced by a new token, renew the token if (!dttr.isTimerCancelled()) { renewToken(dttr); setTimerForTokenRenewal(dttr);// set the next one } else { LOG.info("The token was removed already. Token = [" +dttr +"]"); } } catch (Exception e) { LOG.error("Exception renewing token" + token + ". Not rescheduled", e); removeFailedDelegationToken(dttr); } }
@Override public void run() { if (cancelled.get()) { return; } Token<?> token = dttr.token; try { requestNewHdfsDelegationTokenIfNeeded(dttr); // if the token is not replaced by a new token, renew the token if (!dttr.isTimerCancelled()) { renewToken(dttr); setTimerForTokenRenewal(dttr);// set the next one } else { LOG.info("The token was removed already. Token = [" +dttr +"]"); } } catch (Exception e) { LOG.error("Exception renewing token" + token + ". Not rescheduled", e); removeFailedDelegationToken(dttr); } }
@Test public void testTokenRenewerInvalidReturn() throws Exception { DelegationTokenToRenew mockDttr = mock(DelegationTokenToRenew.class); mockDttr.expirationDate = 0; delegationTokenRenewer.setTimerForTokenRenewal(mockDttr); assertNull(mockDttr.timerTask); mockDttr.expirationDate = -1; delegationTokenRenewer.setTimerForTokenRenewal(mockDttr); assertNull(mockDttr.timerTask); mockDttr.expirationDate = System.currentTimeMillis() - 1; delegationTokenRenewer.setTimerForTokenRenewal(mockDttr); assertNull(mockDttr.timerTask); }
} else { appTokens.get(applicationId).add(dtr); setTimerForTokenRenewal(dtr);
} else { appTokens.get(applicationId).add(dtr); setTimerForTokenRenewal(dtr);
} else { appTokens.get(applicationId).add(dtr); setTimerForTokenRenewal(dtr);
setTimerForTokenRenewal(tokenToRenew); for (ApplicationId applicationId : referringAppIds) { appTokens.get(applicationId).add(tokenToRenew);
setTimerForTokenRenewal(tokenToRenew); for (ApplicationId applicationId : referringAppIds) { appTokens.get(applicationId).add(tokenToRenew);
setTimerForTokenRenewal(tokenToRenew); for (ApplicationId applicationId : referringAppIds) { appTokens.get(applicationId).add(tokenToRenew);