[java-shib-attribute] branch main updated: JSATTR-29 Data connector caching improvements

Rod Widdowson rdw at steadingsoftware.com
Thu Jul 11 12:41:33 UTC 2024


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository java-shib-attribute.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-attribute.git;a=commit;h=6ec7d4b7830b17590261803a4c04ffe5f406f55f

The following commit(s) were added to refs/heads/main by this push:
     new 6ec7d4b78 JSATTR-29 Data connector caching improvements
6ec7d4b78 is described below

commit 6ec7d4b7830b17590261803a4c04ffe5f406f55f
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Jul 11 13:40:52 2024 +0100

    JSATTR-29 Data connector caching improvements
    
    https://shibboleth.atlassian.net/browse/JSATTR-29
    
    Move a all trace logging up to debug.  Some code tidy
---
 .../resolver/dc/impl/AbstractSearchDataConnector.java | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/shib-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/impl/AbstractSearchDataConnector.java b/shib-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/impl/AbstractSearchDataConnector.java
index ea0934d89..feef21b1d 100644
--- a/shib-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/impl/AbstractSearchDataConnector.java
+++ b/shib-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/impl/AbstractSearchDataConnector.java
@@ -176,28 +176,27 @@ public abstract class AbstractSearchDataConnector<T1 extends ExecutableSearch,T2
                         getDataConnectorDependencies());
         final T1 executable = searchBuilder.build(resolutionContext, dependsAttributes);
         Map<String, IdPAttribute> resolvedAttributes = null;
-        if (resultsCache != null && resolutionContext.getAllowCachedResults()) {
+        final Cache<String,Map<String,IdPAttribute>> cache = resultsCache;
+        if (cache != null && resolutionContext.getAllowCachedResults()) {
             final String cacheKey = executable.getResultCacheKey();
             if (cacheKey != null) {
-                assert resultsCache != null;
-                resolvedAttributes = resultsCache.getIfPresent(cacheKey);
-                log.trace("{} Cache key returned, resolved attributes {} using cache {}", new Object[] {getLogPrefix(),
+                resolvedAttributes = cache.getIfPresent(cacheKey);
+                log.debug("{} Cache key returned, resolved attributes {} using cache {}", new Object[] {getLogPrefix(),
                         resolvedAttributes, resultsCache,});
                 if (resolvedAttributes == null) {
                     resolvedAttributes = retrieveAttributes(executable);
-                    log.trace("{} Resolved attributes {}", getLogPrefix(), resolvedAttributes);
-                    assert resultsCache != null;
-                    resultsCache.put(cacheKey, resolvedAttributes != null ? resolvedAttributes
+                    log.debug("{} Resolved attributes {}", getLogPrefix(), resolvedAttributes);
+                    cache.put(cacheKey, resolvedAttributes != null ? resolvedAttributes
                             : CollectionSupport.<String,IdPAttribute>emptyMap());
                 }
             } else {
-                log.trace("No cache key returned, will not check for cached results");
+                log.debug("No cache key returned, will not check for cached results");
                 resolvedAttributes = retrieveAttributes(executable);
-                log.trace("{} Resolved attributes: {}", getLogPrefix(), resolvedAttributes);
+                log.debug("{} Resolved attributes: {}", getLogPrefix(), resolvedAttributes);
             }
         } else {
             resolvedAttributes = retrieveAttributes(executable);
-            log.trace("{} Resolved attributes: {}", getLogPrefix(), resolvedAttributes);
+            log.debug("{} Resolved attributes: {}", getLogPrefix(), resolvedAttributes);
         }
 
         return resolvedAttributes;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list