Class DelegationTokenRenewer
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.server.resourcemanager.security.DelegationTokenRenewer
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service
@Private
@Unstable
public class DelegationTokenRenewer
extends org.apache.hadoop.service.AbstractService
Service to renew application delegation tokens.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classclass that is used for keeping tracks of DT to renewNested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddApplicationAsync(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, org.apache.hadoop.security.Credentials ts, boolean shouldCancelAtEnd, String user, org.apache.hadoop.conf.Configuration tokenConf) Asynchronously add application tokens for renewal.voidaddApplicationAsyncDuringRecovery(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, org.apache.hadoop.security.Credentials ts, boolean shouldCancelAtEnd, String user, org.apache.hadoop.conf.Configuration tokenConf) Asynchronously add application tokens for renewal.voidaddApplicationSync(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, org.apache.hadoop.security.Credentials ts, boolean shouldCancelAtEnd, String user) voidapplicationFinished(org.apache.hadoop.yarn.api.records.ApplicationId applicationId) Removing delegation token for completed applications.protected ThreadPoolExecutorcreateNewThreadPoolService(org.apache.hadoop.conf.Configuration conf) protected ConcurrentMap<org.apache.hadoop.security.token.Token<?>,DelegationTokenRenewer.DelegationTokenToRenew> Set<org.apache.hadoop.security.token.Token<?>>protected org.apache.hadoop.security.token.Token<?>[]obtainSystemTokensForUser(String user, org.apache.hadoop.security.Credentials credentials) protected voidprotected voidserviceInit(org.apache.hadoop.conf.Configuration conf) protected voidprotected voidvoidsetDelegationTokenRenewerPoolTracker(boolean flag) voidsetRMContext(RMContext rmContext) protected voidset task to renew the token.voidupdateKeepAliveApplications(List<org.apache.hadoop.yarn.api.records.ApplicationId> appIds) Add a list of applications to the keep alive list.Methods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Field Details
-
HDFS_DELEGATION_KIND
@VisibleForTesting public static final org.apache.hadoop.io.Text HDFS_DELEGATION_KIND -
SCHEME
- See Also:
-
RM_SYSTEM_CREDENTIALS_VALID_TIME_REMAINING
- See Also:
-
DEFAULT_RM_SYSTEM_CREDENTIALS_VALID_TIME_REMAINING
public static final long DEFAULT_RM_SYSTEM_CREDENTIALS_VALID_TIME_REMAINING- See Also:
-
-
Constructor Details
-
DelegationTokenRenewer
public DelegationTokenRenewer()
-
-
Method Details
-
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
createNewThreadPoolService
-
serviceStart
- Overrides:
serviceStartin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStop
protected void serviceStop()- Overrides:
serviceStopin classorg.apache.hadoop.service.AbstractService
-
getDelegationTokens
-
addApplicationAsync
public void addApplicationAsync(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, org.apache.hadoop.security.Credentials ts, boolean shouldCancelAtEnd, String user, org.apache.hadoop.conf.Configuration tokenConf) Asynchronously add application tokens for renewal.- Parameters:
applicationId- added applicationts- tokensshouldCancelAtEnd- true if tokens should be canceled when the app is done else false.user- usertokenConf- tokenConf sent by the app-submitter
-
addApplicationAsyncDuringRecovery
public void addApplicationAsyncDuringRecovery(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, org.apache.hadoop.security.Credentials ts, boolean shouldCancelAtEnd, String user, org.apache.hadoop.conf.Configuration tokenConf) Asynchronously add application tokens for renewal.- Parameters:
applicationId- added applicationts- tokensshouldCancelAtEnd- true if tokens should be canceled when the app is done else false.user- usertokenConf- tokenConf sent by the app-submitter
-
addApplicationSync
public void addApplicationSync(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, org.apache.hadoop.security.Credentials ts, boolean shouldCancelAtEnd, String user) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
setTimerForTokenRenewal
@VisibleForTesting protected void setTimerForTokenRenewal(DelegationTokenRenewer.DelegationTokenToRenew token) throws IOException set task to renew the token.- Parameters:
token- DelegationTokenToRenew.- Throws:
IOException- if an IO error occurred.
-
renewToken
@VisibleForTesting protected void renewToken(DelegationTokenRenewer.DelegationTokenToRenew dttr) throws IOException - Throws:
IOException
-
obtainSystemTokensForUser
@VisibleForTesting protected org.apache.hadoop.security.token.Token<?>[] obtainSystemTokensForUser(String user, org.apache.hadoop.security.Credentials credentials) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
applicationFinished
public void applicationFinished(org.apache.hadoop.yarn.api.records.ApplicationId applicationId) Removing delegation token for completed applications.- Parameters:
applicationId- completed application
-
updateKeepAliveApplications
public void updateKeepAliveApplications(List<org.apache.hadoop.yarn.api.records.ApplicationId> appIds) Add a list of applications to the keep alive list. If an appId already exists, update it's keep-alive time.- Parameters:
appIds- the list of applicationIds to be kept alive.
-
setRMContext
-
setDelegationTokenRenewerPoolTracker
@VisibleForTesting public void setDelegationTokenRenewerPoolTracker(boolean flag) -
getAllTokens
protected ConcurrentMap<org.apache.hadoop.security.token.Token<?>,DelegationTokenRenewer.DelegationTokenToRenew> getAllTokens()
-