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 2019/01/09 12:26:18 UTC
[myfaces] branch master updated: [perf] use cached RuntimeConfig in
the ApplicationImpl
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 3a1b36f [perf] use cached RuntimeConfig in the ApplicationImpl
3a1b36f is described below
commit 3a1b36f460ee66114acc1a0e26cf0106fac20002
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Wed Jan 9 13:26:11 2019 +0100
[perf] use cached RuntimeConfig in the ApplicationImpl
---
.../org/apache/myfaces/application/ApplicationImpl.java | 17 +++--------------
.../java/org/apache/myfaces/config/RuntimeConfig.java | 6 ++++++
2 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java b/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
index 4541739..1eb35e0 100755
--- a/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
@@ -240,13 +240,7 @@ public class ApplicationImpl extends Application
public ApplicationImpl()
{
- this(getRuntimeConfig());
- }
-
- private static RuntimeConfig getRuntimeConfig()
- {
- return RuntimeConfig.getCurrentInstance(
- FacesContext.getCurrentInstance().getExternalContext());
+ this(RuntimeConfig.getCurrentInstance(FacesContext.getCurrentInstance()));
}
ApplicationImpl(final RuntimeConfig runtimeConfig)
@@ -430,7 +424,7 @@ public class ApplicationImpl extends Application
String getBundleName(final FacesContext facesContext, final String name)
{
- ResourceBundle bundle = getRuntimeConfig(facesContext).getResourceBundle(name);
+ ResourceBundle bundle = _runtimeConfig.getResourceBundle(name);
return bundle != null ? bundle.getBaseName() : null;
}
@@ -440,11 +434,6 @@ public class ApplicationImpl extends Application
return java.util.ResourceBundle.getBundle(name, locale, loader);
}
- final RuntimeConfig getRuntimeConfig(final FacesContext facesContext)
- {
- return RuntimeConfig.getCurrentInstance(facesContext.getExternalContext());
- }
-
final FacesContext getFacesContext()
{
return FacesContext.getCurrentInstance();
@@ -2621,7 +2610,7 @@ public class ApplicationImpl extends Application
// Chain of responsibility pattern
CompositeSearchKeywordResolver baseResolver = new CompositeSearchKeywordResolver();
- for (SearchKeywordResolver child : getRuntimeConfig().getApplicationSearchExpressionResolvers())
+ for (SearchKeywordResolver child : _runtimeConfig.getApplicationSearchExpressionResolvers())
{
baseResolver.add(child);
}
diff --git a/impl/src/main/java/org/apache/myfaces/config/RuntimeConfig.java b/impl/src/main/java/org/apache/myfaces/config/RuntimeConfig.java
index 209240c..f470933 100755
--- a/impl/src/main/java/org/apache/myfaces/config/RuntimeConfig.java
+++ b/impl/src/main/java/org/apache/myfaces/config/RuntimeConfig.java
@@ -36,6 +36,7 @@ import javax.el.ELResolver;
import javax.el.ExpressionFactory;
import javax.faces.component.search.SearchKeywordResolver;
import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
import org.apache.myfaces.config.element.ComponentTagDeclaration;
import org.apache.myfaces.config.element.FaceletsProcessing;
@@ -118,6 +119,11 @@ public class RuntimeConfig
private List<String> _faceletTemplates = new ArrayList<String>();
+ public static RuntimeConfig getCurrentInstance(FacesContext facesContext)
+ {
+ return getCurrentInstance(facesContext.getExternalContext());
+ }
+
public static RuntimeConfig getCurrentInstance(ExternalContext externalContext)
{
RuntimeConfig runtimeConfig = (RuntimeConfig) externalContext.getApplicationMap().get(