You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2020/06/05 14:21:12 UTC
[myfaces] branch master updated: use cache
This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/master by this push:
new c2c792b use cache
c2c792b is described below
commit c2c792bcc9c7be5af70d071360f2dbd8934ff135
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Fri Jun 5 16:21:02 2020 +0200
use cache
---
.../api/shared/lang/PropertyDescriptorUtils.java | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/api/src/main/java/org/apache/myfaces/core/api/shared/lang/PropertyDescriptorUtils.java b/api/src/main/java/org/apache/myfaces/core/api/shared/lang/PropertyDescriptorUtils.java
index a061c6a..4bac081 100644
--- a/api/src/main/java/org/apache/myfaces/core/api/shared/lang/PropertyDescriptorUtils.java
+++ b/api/src/main/java/org/apache/myfaces/core/api/shared/lang/PropertyDescriptorUtils.java
@@ -66,26 +66,16 @@ public class PropertyDescriptorUtils
private static Map<String, Map<String, ? extends PropertyDescriptorWrapper>> getCache(ExternalContext ec)
{
- Map<String, Map<String, ? extends PropertyDescriptorWrapper>> cache =
- (Map<String, Map<String, ? extends PropertyDescriptorWrapper>>)
- ec.getApplicationMap().get(CACHE_KEY);
- if (cache == null)
- {
- cache = new ConcurrentHashMap<>(1000);
- }
-
- return cache;
+ return (Map<String, Map<String, ? extends PropertyDescriptorWrapper>>)
+ ec.getApplicationMap().computeIfAbsent(CACHE_KEY, k -> new ConcurrentHashMap<>(1000));
}
-
+
public static Map<String, ? extends PropertyDescriptorWrapper> getCachedPropertyDescriptors(ExternalContext ec,
Class<?> target)
{
- return getCache(ec).computeIfAbsent(target.getName(), k ->
- {
- return getPropertyDescriptors(ec, target, false);
- });
+ return getCache(ec).computeIfAbsent(target.getName(), k -> getPropertyDescriptors(ec, target, false));
}
-
+
public static boolean isMethodHandlesSupported(ExternalContext ec)
{
if (privateLookupIn == null)