You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by aj...@apache.org on 2019/03/12 04:22:20 UTC
[hadoop] branch ozone-0.4 updated: HDDS-1245. OM delegation expiration time should use Time.now instead … (#587)
This is an automated email from the ASF dual-hosted git repository.
ajay pushed a commit to branch ozone-0.4
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/ozone-0.4 by this push:
new e673beb HDDS-1245. OM delegation expiration time should use Time.now instead … (#587)
e673beb is described below
commit e673bebcfe3e15a855918dbb0e63e5c31377dc23
Author: Xiaoyu Yao <xy...@apache.org>
AuthorDate: Mon Mar 11 21:15:40 2019 -0700
HDDS-1245. OM delegation expiration time should use Time.now instead … (#587)
Closes #587.
(cherry picked from commit c7307867f0d28dbb11e2194ff885da8269e4fb42)
---
.../ozone/security/OzoneDelegationTokenSecretManager.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/security/OzoneDelegationTokenSecretManager.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/security/OzoneDelegationTokenSecretManager.java
index d520aab..efd29d0 100644
--- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/security/OzoneDelegationTokenSecretManager.java
+++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/security/OzoneDelegationTokenSecretManager.java
@@ -158,12 +158,12 @@ public class OzoneDelegationTokenSecretManager
*/
private void updateIdentifierDetails(OzoneTokenIdentifier identifier) {
int sequenceNum;
- long now = Time.monotonicNow();
+ long now = Time.now();
sequenceNum = incrementDelegationTokenSeqNum();
identifier.setIssueDate(now);
identifier.setMasterKeyId(getCurrentKey().getKeyId());
identifier.setSequenceNumber(sequenceNum);
- identifier.setMaxDate(Time.monotonicNow() + getTokenMaxLifetime());
+ identifier.setMaxDate(now + getTokenMaxLifetime());
identifier.setOmCertSerialId(getOmCertificateSerialId());
}
@@ -198,7 +198,7 @@ public class OzoneDelegationTokenSecretManager
formatTokenId(id), currentTokens.size());
}
- long now = Time.monotonicNow();
+ long now = Time.now();
if (id.getMaxDate() < now) {
throw new OMException(renewer + " tried to renew an expired token "
+ formatTokenId(id) + " max expiration date: "
@@ -293,7 +293,7 @@ public class OzoneDelegationTokenSecretManager
throw new InvalidToken("token " + formatTokenId(identifier)
+ " can't be found in cache");
}
- long now = Time.monotonicNow();
+ long now = Time.now();
if (info.getRenewDate() < now) {
throw new InvalidToken("token " + formatTokenId(identifier) + " is " +
"expired, current time: " + Time.formatTime(now) +
@@ -329,7 +329,7 @@ public class OzoneDelegationTokenSecretManager
// TODO: handle roll private key/certificate
private synchronized void removeExpiredKeys() {
- long now = Time.monotonicNow();
+ long now = Time.now();
for (Iterator<Map.Entry<Integer, OzoneSecretKey>> it = allKeys.entrySet()
.iterator(); it.hasNext();) {
Map.Entry<Integer, OzoneSecretKey> e = it.next();
@@ -447,7 +447,7 @@ public class OzoneDelegationTokenSecretManager
* Remove expired delegation tokens from cache and persisted store.
*/
private void removeExpiredToken() {
- long now = Time.monotonicNow();
+ long now = Time.now();
synchronized (this) {
Iterator<Map.Entry<OzoneTokenIdentifier,
TokenInfo>> i = currentTokens.entrySet().iterator();
@@ -480,7 +480,7 @@ public class OzoneDelegationTokenSecretManager
/ (60 * 1000) + " min(s)");
try {
while (isRunning()) {
- long now = Time.monotonicNow();
+ long now = Time.now();
if (lastTokenCacheCleanup + getTokenRemoverScanInterval()
< now) {
removeExpiredToken();
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org