You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2007/08/02 10:40:15 UTC

svn commit: r562046 - /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java

Author: mmarinschek
Date: Thu Aug  2 01:40:14 2007
New Revision: 562046

URL: http://svn.apache.org/viewvc?view=rev&rev=562046
Log:
https://issues.apache.org/jira/browse/MYFACES-1689: added a log message with information how to switch reloading off

Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java?view=diff&rev=562046&r1=562045&r2=562046
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java Thu Aug  2 01:40:14 2007
@@ -158,41 +158,42 @@
         if (refreshPeriod > 0){
             long ttl = lastUpdate + refreshPeriod;
             if ((System.currentTimeMillis() > ttl) && (getLastModifiedTime() > ttl)) {
-                try {
-                    purgeConfiguration();
-                } catch (NoSuchMethodException e) {
-                    log.error("Configuration objects do not support clean-up. Update aborted");
-                    return;
-                } catch (IllegalAccessException e) {
-                    log.fatal("Error during configuration clean-up" + e.getMessage());
-                } catch (InvocationTargetException e) {
-                    log.fatal("Error during configuration clean-up" + e.getMessage());
-                }
+                log.info("Faces config-files are being reloaded. If you don't want this reload to happen (e.g. in production), set the web-xml-parameter: "+MyfacesConfig.INIT_PARAM_CONFIG_REFRESH_PERIOD +" to -1.");
+                purgeConfiguration();
                 configure();
             }
         }
     }
 
-    private void purgeConfiguration() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+    private void purgeConfiguration() {
 
-        Method purgeMethod;
-        Class[] emptyParameterList = new Class[]{};
-
-        ApplicationFactory applicationFactory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
-        purgeMethod = applicationFactory.getClass().getMethod("purgeApplication", emptyParameterList);
-        purgeMethod.invoke(applicationFactory, emptyParameterList);
-
-        RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
-        purgeMethod = renderKitFactory.getClass().getMethod("purgeRenderKit", emptyParameterList);
-        purgeMethod.invoke(renderKitFactory, emptyParameterList);
-
-        RuntimeConfig.getCurrentInstance(_externalContext).purge();
-
-        LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
-        purgeMethod = lifecycleFactory.getClass().getMethod("purgeLifecycle", emptyParameterList);
-        purgeMethod.invoke(lifecycleFactory, emptyParameterList);
-
-        // factories and serial factory need not be purged...
+        try {
+            Method purgeMethod;
+            Class[] emptyParameterList = new Class[]{};
+
+            ApplicationFactory applicationFactory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
+            purgeMethod = applicationFactory.getClass().getMethod("purgeApplication", emptyParameterList);
+            purgeMethod.invoke(applicationFactory, emptyParameterList);
+
+            RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+            purgeMethod = renderKitFactory.getClass().getMethod("purgeRenderKit", emptyParameterList);
+            purgeMethod.invoke(renderKitFactory, emptyParameterList);
+
+            RuntimeConfig.getCurrentInstance(_externalContext).purge();
+
+            LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+            purgeMethod = lifecycleFactory.getClass().getMethod("purgeLifecycle", emptyParameterList);
+            purgeMethod.invoke(lifecycleFactory, emptyParameterList);
+
+            // factories and serial factory need not be purged...
+        } catch (NoSuchMethodException e) {
+            log.error("Configuration objects do not support clean-up. Update aborted");
+            return;
+        } catch (IllegalAccessException e) {
+            log.fatal("Error during configuration clean-up" + e.getMessage());
+        } catch (InvocationTargetException e) {
+            log.fatal("Error during configuration clean-up" + e.getMessage());
+        }
     }
 
     public void configure()