You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by rd...@apache.org on 2011/01/10 09:50:27 UTC
svn commit: r1057124 -
/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValLifecycleWrapper.java
Author: rdebusscher
Date: Mon Jan 10 08:50:27 2011
New Revision: 1057124
URL: http://svn.apache.org/viewvc?rev=1057124&view=rev
Log:
EXTVAL-123: Improve performance (remarked by Gerhard)
Modified:
myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValLifecycleWrapper.java
Modified: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValLifecycleWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValLifecycleWrapper.java?rev=1057124&r1=1057123&r2=1057124&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValLifecycleWrapper.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValLifecycleWrapper.java Mon Jan 10 08:50:27 2011
@@ -29,6 +29,7 @@ import javax.faces.lifecycle.Lifecycle;
/**
* Wrapper around a Lifecycle that initialise the ExtVal PhaseListeners before an execution of any
* phase (except the render view). Solution for the issue EXTVAL-123.
+ *
* @author Rudy De Busscher
* @author Gerard Petracek
* @since x.x.5
@@ -38,10 +39,11 @@ class ExtValLifecycleWrapper extends Lif
{
private Lifecycle wrapped;
+ private boolean initialized = false;
+
ExtValLifecycleWrapper(Lifecycle wrapped)
{
this.wrapped = wrapped;
-
}
public void addPhaseListener(PhaseListener phaseListener)
@@ -52,7 +54,10 @@ class ExtValLifecycleWrapper extends Lif
public void execute(FacesContext facesContext)
throws FacesException
{
- initializeExtVal();
+ if(!this.initialized)
+ {
+ initializeExtVal();
+ }
wrapped.execute(facesContext);
}
@@ -75,9 +80,9 @@ class ExtValLifecycleWrapper extends Lif
}
- private void initializeExtVal()
+ private synchronized void initializeExtVal()
{
-
+ //we don't need further checks - startup listeners are deregistered after the invocation.
for (PhaseListener currentPhaseListener : getPhaseListeners())
{
if (currentPhaseListener instanceof AbstractStartupListener)
@@ -85,6 +90,6 @@ class ExtValLifecycleWrapper extends Lif
currentPhaseListener.beforePhase(null);
}
}
+ this.initialized = true;
}
-
}