You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2010/03/10 15:16:26 UTC
svn commit: r921358 -
/myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/api/MyFacesBeanHandler.java
Author: werpu
Date: Wed Mar 10 14:16:26 2010
New Revision: 921358
URL: http://svn.apache.org/viewvc?rev=921358&view=rev
Log:
small refactoring issue, there was too much refactoring
Modified:
myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/api/MyFacesBeanHandler.java
Modified: myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/api/MyFacesBeanHandler.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/api/MyFacesBeanHandler.java?rev=921358&r1=921357&r2=921358&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/api/MyFacesBeanHandler.java (original)
+++ myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/api/MyFacesBeanHandler.java Wed Mar 10 14:16:26 2010
@@ -19,6 +19,8 @@
package org.apache.myfaces.scripting.api;
import org.apache.myfaces.config.RuntimeConfig;
+import org.apache.myfaces.config.annotation.LifecycleProvider;
+import org.apache.myfaces.config.annotation.LifecycleProviderFactory;
import org.apache.myfaces.config.element.ListEntries;
import org.apache.myfaces.config.element.ManagedBean;
import org.apache.myfaces.config.element.MapEntries;
@@ -30,6 +32,7 @@ import org.apache.myfaces.scripting.refr
import org.apache.myfaces.scripting.refresh.ReloadingMetadata;
import javax.faces.context.FacesContext;
+import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -220,6 +223,8 @@ public class MyFacesBeanHandler implemen
//But for most cases this mutex should be enough
Map<String, ManagedBean> mbeansSnapshotView = makeSnapshot(mbeans);
+
+
for (Map.Entry<String, ManagedBean> entry : mbeansSnapshotView.entrySet()) {
Class managedBeanClass = entry.getValue().getManagedBeanClass();
if (hasToBeRefreshed(taintedInTime, managedBeanClass)) {
@@ -274,7 +279,16 @@ public class MyFacesBeanHandler implemen
//we now have to revert to introspection here because scopes are a pure jsf2 construct
//so we use a messaging pattern here to cope with it
- ReflectUtil.executeMethod(scopeImpl, "remove", bean.getManagedBeanName());
+ Object beanInstance = ReflectUtil.executeMethod(scopeImpl, "get", bean.getManagedBeanName());
+ LifecycleProvider lifecycleProvider =
+ LifecycleProviderFactory.getLifecycleProviderFactory().getLifecycleProvider(FacesContext.getCurrentInstance().getExternalContext());
+ try {
+ lifecycleProvider.destroyInstance(beanInstance);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ } catch (InvocationTargetException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
}
/**