[java-opensaml] 01/03: OSJ-234: Reset next dynamic metadata refresh when entity is unchanged
Brent Putman
putmanb at georgetown.edu
Fri Sep 14 22:54:21 EDT 2018
This is an automated email from the git hooks/post-receive script.
putmanb pushed a commit to branch master
in repository java-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=5cddddcf1fb11ac40e0bb2d767df9f02f0887f6b
commit 5cddddcf1fb11ac40e0bb2d767df9f02f0887f6b
Author: Brent Putman <putmanb at georgetown.edu>
AuthorDate: Thu Sep 13 21:11:18 2018 -0400
OSJ-234: Reset next dynamic metadata refresh when entity is unchanged
---
.../impl/AbstractDynamicMetadataResolver.java | 25 +++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolver.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolver.java
index db93405..23fc174 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolver.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolver.java
@@ -625,8 +625,14 @@ public abstract class AbstractDynamicMetadataResolver extends AbstractMetadataRe
if (root == null) {
mgmtData.initNegativeLookupCache();
- // TODO: recalc and set refresh time if have existing descriptor
log.debug("{} No metadata was fetched from the origin source", getLogPrefix());
+
+ if (!descriptors.isEmpty()) {
+ mgmtData.setRefreshTriggerTime(computeRefreshTriggerTime(mgmtData.getExpirationTime(),
+ new DateTime(ISOChronology.getInstanceUTC())));
+ log.debug("{} Had existing data, recalculated refresh trigger time as: {}",
+ getLogPrefix(), mgmtData.getRefreshTriggerTime());
+ }
} else {
mgmtData.clearNegativeLookupCache();
try {
@@ -1318,17 +1324,30 @@ public abstract class AbstractDynamicMetadataResolver extends AbstractMetadataRe
lastAccessedTime = new DateTime(ISOChronology.getInstanceUTC());
}
+ /**
+ * Determine whether the negative lookup cache for the entity is in effect.
+ *
+ * @return true if active, false otherwise
+ */
public boolean isNegativeLookupCacheActive() {
- DateTime now = new DateTime(ISOChronology.getInstanceUTC());
+ final DateTime now = new DateTime(ISOChronology.getInstanceUTC());
return negativeLookupCacheExpiration != null && now.isBefore(negativeLookupCacheExpiration);
}
+ /**
+ * Initialize the negative lookup cache for the entity.
+ *
+ * @return the time before which no further lookups for the entity will be performed
+ */
public DateTime initNegativeLookupCache() {
- DateTime now = new DateTime(ISOChronology.getInstanceUTC());
+ final DateTime now = new DateTime(ISOChronology.getInstanceUTC());
negativeLookupCacheExpiration = now.plus(getNegativeLookupCacheDuration());
return negativeLookupCacheExpiration;
}
+ /**
+ * Clear out the negative lookup cache.
+ */
public void clearNegativeLookupCache() {
negativeLookupCacheExpiration = null;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list