/// <exception cref="Org.Apache.Hadoop.Security.Token.SecretManager.InvalidToken"/> public virtual long GetRenewDate(RMDelegationTokenIdentifier ident) { AbstractDelegationTokenSecretManager.DelegationTokenInformation info = currentTokens [ident]; if (info == null) { throw new SecretManager.InvalidToken("token (" + ident.ToString() + ") can't be found in cache" ); } return(info.GetRenewDate()); }
/// <summary>Returns expiry time of a token given its identifier.</summary> /// <param name="dtId">DelegationTokenIdentifier of a token</param> /// <returns>Expiry time of the token</returns> /// <exception cref="System.IO.IOException"/> public virtual long GetTokenExpiryTime(DelegationTokenIdentifier dtId) { lock (this) { AbstractDelegationTokenSecretManager.DelegationTokenInformation info = currentTokens [dtId]; if (info != null) { return(info.GetRenewDate()); } else { throw new IOException("No delegation token found for this identifier"); } } }
/// <summary>Private helper methods to save delegation keys and tokens in fsimage</summary> /// <exception cref="System.IO.IOException"/> private void SaveCurrentTokens(DataOutputStream @out, string sdPath) { lock (this) { StartupProgress prog = NameNode.GetStartupProgress(); Step step = new Step(StepType.DelegationTokens, sdPath); prog.BeginStep(Phase.SavingCheckpoint, step); prog.SetTotal(Phase.SavingCheckpoint, step, this._enclosing.currentTokens.Count); StartupProgress.Counter counter = prog.GetCounter(Phase.SavingCheckpoint, step); @out.WriteInt(this._enclosing.currentTokens.Count); IEnumerator <DelegationTokenIdentifier> iter = this._enclosing.currentTokens.Keys. GetEnumerator(); while (iter.HasNext()) { DelegationTokenIdentifier id = iter.Next(); id.Write(@out); AbstractDelegationTokenSecretManager.DelegationTokenInformation info = this._enclosing .currentTokens[id]; @out.WriteLong(info.GetRenewDate()); counter.Increment(); } prog.EndStep(Phase.SavingCheckpoint, step); } }