You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by bu...@apache.org on 2005/01/04 12:49:44 UTC
DO NOT REPLY [Bug 32935] New: -
[PATCH] Popular website with XSP homepage won't come up
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32935>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=32935
Summary: [PATCH] Popular website with XSP homepage won't come up
Product: Cocoon 2
Version: Current SVN 2.1
Platform: All
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: blocks
AssignedTo: dev@cocoon.apache.org
ReportedBy: Alfred.Nathaniel@swx.com
Whilst the cache of compiled XSPs is empty, each thread entering
a.o.c.components.language.generator.ProgramGeneratorImpl.load queues for the
lock on self and before compiling the XSP.
If during startup requests for an XSP arrive faster than the time it takes to
compile the XSP, the server will be on its knees recompiling the same XSP over
and over again. Therefore a popular website with an XSP homepage will have a
hard time to come up.
PATCH
=====
After acquiring the lock, check again the cache:
--- ProgramGeneratorImpl.java 7 Jul 2003 14:32:15 -0000 1.1.1.3
+++ ProgramGeneratorImpl.java 4 Jan 2005 11:27:14 -0000
@@ -290,21 +290,31 @@
}
if (programInstance == null) {
- // no instance found
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Creating new serverpage for [" + id
+ "]");
- }
synchronized (this) {
- generateSourcecode(source,
- normalizedName,
- markupLanguage,
- programmingLanguage);
-
- programInstance = loadProgram(newManager,
- 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 (ComponentException 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);
+ }
+ }
} else {
// found an instance
if (this.autoReload) {
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.