cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anathan...@apache.org
Subject svn commit: r179150 - in /cocoon: blocks/xsp/trunk/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java trunk/status.xml
Date Mon, 30 May 2005 21:23:54 GMT
Author: anathaniel
Date: Mon May 30 14:23:52 2005
New Revision: 179150

URL: http://svn.apache.org/viewcvs?rev=179150&view=rev
Log:
XSP Block: Double check and attempt again to load program object from cache.
This avoids that simultaneous requests recompile the same XSP over and over again.

Modified:
    cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java
    cocoon/trunk/status.xml

Modified: cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java?rev=179150&r1=179149&r2=179150&view=diff
==============================================================================
--- cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java
(original)
+++ cocoon/blocks/xsp/trunk/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java
Mon May 30 14:23:52 2005
@@ -267,20 +267,30 @@
             }
 
             if (programInstance == null) {
-                // no instance found
-                if (getLogger().isDebugEnabled()) {
-                    getLogger().debug("Creating new serverpage for [" + id + "]");
-                }
                 synchronized (this) {
-                    generateSourcecode(source,
-                                       normalizedName,
-                                       markupLanguage,
-                                       programmingLanguage);
+                    // Attempt again to load program object from cache.
+                    // This avoids that simultaneous requests recompile
+                    // the same XSP over and over again.
+                    try {
+                        programInstance = (CompiledComponent) this.cache.select(normalizedName);
+                        if (getLogger().isDebugEnabled()) {
+                            getLogger().debug("The serverpage [" + id + "] was now in the
cache");
+                        }
+                    } catch (Exception e) {
+                        // no instance found
+                        if (getLogger().isDebugEnabled()) {
+                            getLogger().debug("Creating new serverpage for [" + id + "]");
+                        }
+                        generateSourcecode(source,
+                                           normalizedName,
+                                           markupLanguage,
+                                           programmingLanguage);
 
-                    programInstance = loadProgram(newManager,
-                                                  normalizedName,
-                                                  markupLanguage,
-                                                  programmingLanguage);
+                        programInstance = loadProgram(newManager,
+                                                      normalizedName,
+                                                      markupLanguage,
+                                                      programmingLanguage);
+                    }
                 }
             } else {
                 // found an instance

Modified: cocoon/trunk/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/status.xml?rev=179150&r1=179149&r2=179150&view=diff
==============================================================================
--- cocoon/trunk/status.xml (original)
+++ cocoon/trunk/status.xml Mon May 30 14:23:52 2005
@@ -197,6 +197,10 @@
 
   <changes>
   <release version="@version@" date="@date@">
+    <action dev="AN" type="fix" fixes-bug="32935">
+      XSP Block: Double check and attempt again to load program object from cache.
+      This avoids that simultaneous requests recompile the same XSP over and over again.
+    </action>
    <action dev="DF" type="update">
      Added reflection friendly utility methods for the Cocoon environment according to vote
      http://marc.theaimsgroup.com/?t=111590936900001&amp;r=1&amp;w=2:



Mime
View raw message