Author: mrdon
Date: Sat Aug 13 19:09:09 2005
New Revision: 232568

URL: http://svn.apache.org/viewcvs?rev=232568&view=rev
Log:
Changing action method caching to only happen when not in dev mode.  Dev 
mode reloads classes on changes, so cached methods won't work.


Modified:
    
struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerActionInvocation.java

Modified: 
struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerActionInvocation.java
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerActionInvocation.java?rev=232568&r1=232567&r2=232568&view=diff
==============================================================================
--- 
struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerActionInvocation.java
 (original)
+++ 
struts/sandbox/trunk/ti/src/java/org/apache/ti/processor/ControllerActionInvocation.java
 Sat Aug 13 19:09:09 2005
@@ -33,6 +33,7 @@
     protected Method actionMethod;
     protected Object form;
     protected InvokeAction invokeAction;
+    protected boolean devMode;
     
     protected ControllerActionInvocation(ActionProxy proxy) throws Exception {
         this(proxy, null);
@@ -50,6 +51,10 @@
         this.invokeAction = inv;
     }
 
+    public void setDevMode(boolean devMode) {
+        this.devMode = devMode;
+    }    
+
     public Object invokeActionEvent(String eventName, boolean optional) throws 
Exception {
         return invokeActionEvent(eventName, null, null, optional);
     }
@@ -107,11 +112,13 @@
     }
     
     public Method getActionMethod() {
+        Method method = null;
+        
         // TODO: this should be optimized 
         if (actionMethod == null) {
             if (getAction() != null) {
                 try {
-                    actionMethod = 
proxy.getConfig().getMethod(getAction().getClass());
+                    method = 
proxy.getConfig().getMethod(getAction().getClass());
                 } catch (NoSuchMethodException ex) {
                     Class cls = getAction().getClass();
                     String methodName = proxy.getConfig().getMethodName();
@@ -121,19 +128,26 @@
                     for (int x=0; x<methods.length; x++) {
                         if (methods[x].getName().equals(methodName) &&
                             methods[x].getParameterTypes().length == 1) {
-                            actionMethod = methods[x];
+                            method = methods[x];
                             break;
                         }
                     }
                 }
                 
-                if (actionMethod == null) {
+                if (method == null) {
                     throw new IllegalStateException("Cannot location method 
'"+proxy.getConfig().getMethodName()
                         + "' in action '"+getAction().getClass()+"'");
                 }
             }    
+        } else {
+            method = actionMethod;
+         }   
+        
+        if (!devMode) {
+            actionMethod = method;
         }    
-        return actionMethod;
+        
+        return method;
     }
     
     



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to