This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openwebbeans.git
The following commit(s) were added to refs/heads/main by this push:
new 94d92aa6d OWB-1455 - [perf] cache negative results of resolveByType
94d92aa6d is described below
commit 94d92aa6dde5c80bc6a8a3ca7a89ae5b687c1f75
Author: tandraschko <[email protected]>
AuthorDate: Tue Apr 14 16:23:27 2026 +0200
OWB-1455 - [perf] cache negative results of resolveByType
---
.../org/apache/webbeans/container/InjectionResolver.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git
a/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
b/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
index ad94da21b..63b523ce2 100644
---
a/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
+++
b/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
@@ -85,10 +85,9 @@ public class InjectionResolver
private AlternativesManager alternativesManager;
/**
- * This Map contains all resolved beans via it's type and qualifiers.
- * If a bean have resolved as not existing, the entry will contain
<code>null</code> as value.
- * The Long key is a hashCode, see
- * {@link BeanCacheKey#BeanCacheKey(boolean, Type, String,
java.util.function.Function, Annotation...)}
+ * Resolved beans by injection point type and qualifiers ({@link
BeanCacheKey}).
+ * Filled after startup when the bean set is final. Misses are stored as
+ * {@link Collections#emptySet()} so repeated lookups avoid rescanning the
deployment.
*/
private Map<BeanCacheKey, Set<Bean<?>>> resolvedBeansByType = new
ConcurrentHashMap<>();
@@ -500,8 +499,14 @@ public class InjectionResolver
}
}
- if (!startup && !resolvedComponents.isEmpty())
+ if (!startup)
{
+ if (resolvedComponents.isEmpty())
+ {
+ resolvedBeansByType.put(cacheKey, Collections.emptySet());
+ return Collections.emptySet();
+ }
+
resolvedBeansByType.put(cacheKey, resolvedComponents);
if (logger.isLoggable(Level.FINE))