[java-identity-provider COMMIT] /trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver...
noreply at shibboleth.net
noreply at shibboleth.net
Tue Oct 4 10:35:54 EDT 2016
Author: scantor
Date: Tue Oct 4 10:35:54 2016
New Revision: 8462
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=8462&view=rev
Log:
Add timer hooks to resolver plugins.
Modified:
trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPlugin.java
Modified: trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPlugin.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPlugin.java?rev=8462&r1=8461&r2=8462&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPlugin.java (original)
+++ trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPlugin.java Tue Oct 4 10:35:54 2016
@@ -27,6 +27,7 @@
import net.shibboleth.idp.attribute.resolver.context.AttributeResolutionContext;
import net.shibboleth.idp.attribute.resolver.context.AttributeResolverWorkContext;
+import net.shibboleth.idp.profile.context.MetricContext;
import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
import net.shibboleth.utilities.java.support.annotation.constraint.NullableElements;
import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
@@ -173,35 +174,44 @@
Constraint.isNotNull(resolutionContext, "AttributeResolutionContext cannot be null");
- if (null != activationCondition) {
- final ProfileRequestContext profileRequestContext = profileContextStrategy.apply(resolutionContext);
- if (!activationCondition.apply(profileRequestContext)) {
- log.debug("Resolver plugin '{}': activation criteria not met, nothing to do", getId());
- return null;
- }
- }
-
- final AttributeResolverWorkContext workContext =
- resolutionContext.getSubcontext(AttributeResolverWorkContext.class, false);
- Constraint.isNotNull(workContext, "AttributeResolverWorkContext cannot be null");
-
+ final boolean timerStarted = startTimer(resolutionContext);
+
try {
- final ResolvedType result = doResolve(resolutionContext, workContext);
- if (null == result) {
- log.debug("Resolver plugin '{}' produced no value.", getId());
- }
- return result;
- } catch (final ResolutionException e) {
- //
- // NOTE - if you change this logic you MUST make changes in any derived classes that
- // depend on our handling of propagateResolutionExceptions.
- //
- if (propagateResolutionExceptions) {
- throw e;
- } else {
- log.debug("Resolver plugin '{}' produced the following error but was configured not to propagate it.",
- getId(), e);
- return null;
+ if (null != activationCondition) {
+ final ProfileRequestContext profileRequestContext = profileContextStrategy.apply(resolutionContext);
+ if (!activationCondition.apply(profileRequestContext)) {
+ log.debug("Resolver plugin '{}': activation criteria not met, nothing to do", getId());
+ return null;
+ }
+ }
+
+ final AttributeResolverWorkContext workContext =
+ resolutionContext.getSubcontext(AttributeResolverWorkContext.class, false);
+ Constraint.isNotNull(workContext, "AttributeResolverWorkContext cannot be null");
+
+ try {
+ final ResolvedType result = doResolve(resolutionContext, workContext);
+ if (null == result) {
+ log.debug("Resolver plugin '{}' produced no value.", getId());
+ }
+ return result;
+ } catch (final ResolutionException e) {
+ //
+ // NOTE - if you change this logic you MUST make changes in any derived classes that
+ // depend on our handling of propagateResolutionExceptions.
+ //
+ if (propagateResolutionExceptions) {
+ throw e;
+ } else {
+ log.debug(
+ "Resolver plugin '{}' produced the following error but was configured not to propagate it.",
+ getId(), e);
+ return null;
+ }
+ }
+ } finally {
+ if (timerStarted) {
+ stopTimer(resolutionContext);
}
}
}
@@ -261,4 +271,39 @@
@Nullable protected abstract ResolvedType doResolve(@Nonnull final AttributeResolutionContext resolutionContext,
@Nonnull final AttributeResolverWorkContext workContext) throws ResolutionException;
+
+ /**
[... 35 lines stripped ...]
More information about the commits
mailing list