@InterfaceAudience.Public @InterfaceStability.Evolving public class AccessTokenTimer extends Object
Modifier and Type | Field and Description |
---|---|
static long |
EXPIRE_BUFFER_MS |
Constructor and Description |
---|
AccessTokenTimer() |
AccessTokenTimer(org.apache.hadoop.util.Timer timer) |
Modifier and Type | Method and Description |
---|---|
long |
getNextRefreshMSSinceEpoch()
Get next time we should refresh the token.
|
void |
setExpiresIn(String expiresIn)
Set when the access token will expire as reported by the oauth server,
ie in seconds from now.
|
void |
setExpiresInMSSinceEpoch(String expiresInMSSinceEpoch)
Set when the access token will expire in milliseconds from epoch,
as required by the WebHDFS configuration.
|
boolean |
shouldRefresh()
Return true if the current token has expired or will expire within the
EXPIRE_BUFFER_MS (to give ample wiggle room for the call to be made to
the server).
|
public static final long EXPIRE_BUFFER_MS
public AccessTokenTimer()
public AccessTokenTimer(org.apache.hadoop.util.Timer timer)
timer
- Timer instance for unit testingpublic void setExpiresIn(String expiresIn)
expiresIn
- Access time expiration as reported by OAuth serverpublic void setExpiresInMSSinceEpoch(String expiresInMSSinceEpoch)
expiresInMSSinceEpoch
- Access time expiration in ms since epoch.public long getNextRefreshMSSinceEpoch()
public boolean shouldRefresh()
Copyright © 2019 Apache Software Foundation. All rights reserved.