Ejemplo n.º 1
0
 /// <exception cref="System.IO.IOException"/>
 public virtual void CancelToken <_T0>(Org.Apache.Hadoop.Security.Token.Token <_T0>
                                       token, string canceler)
     where _T0 : AbstractDelegationTokenIdentifier
 {
     canceler = (canceler != null) ? canceler : VerifyToken(token).GetShortUserName();
     secretManager.CancelToken(token, canceler);
 }
            /// <exception cref="System.IO.IOException"/>
            /// <exception cref="System.Exception"/>
            public override void Cancel <_T0>(Org.Apache.Hadoop.Security.Token.Token <_T0> token
                                              , Configuration conf)
            {
                ApplicationClientProtocol rmClient = GetRmClient(token, conf);

                if (rmClient != null)
                {
                    try
                    {
                        CancelDelegationTokenRequest request = Records.NewRecord <CancelDelegationTokenRequest
                                                                                  >();
                        request.SetDelegationToken(ConvertToProtoToken(token));
                        rmClient.CancelDelegationToken(request);
                    }
                    catch (YarnException e)
                    {
                        throw new IOException(e);
                    }
                    finally
                    {
                        RPC.StopProxy(rmClient);
                    }
                }
                else
                {
                    localSecretManager.CancelToken((Org.Apache.Hadoop.Security.Token.Token <RMDelegationTokenIdentifier
                                                                                            >)token, GetRenewer(token));
                }
            }