vgritsenko 02/04/27 11:30:50
Modified: src/java/org/apache/cocoon/components/treeprocessor
TreeProcessor.java
Log:
fix reloading.
why child processors' lifecycle methods are not honored?
Revision Changes Path
1.9 +10 -8
xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
Index: TreeProcessor.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TreeProcessor.java 26 Apr 2002 12:33:38 -0000 1.8
+++ TreeProcessor.java 27 Apr 2002 18:30:50 -0000 1.9
@@ -96,7 +96,7 @@
* Interpreted tree-traversal implementation of a pipeline assembly language.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Id: TreeProcessor.java,v 1.8 2002/04/26 12:33:38 cziegeler Exp $
+ * @version CVS $Id: TreeProcessor.java,v 1.9 2002/04/27 18:30:50 vgritsenko Exp $
*/
public class TreeProcessor extends AbstractLoggable implements ThreadSafe,
Processor,
@@ -156,6 +156,9 @@
public TreeProcessor() {
// Language can be overriden in the configuration.
this.language = "sitemap";
+
+ this.checkReload = true;
+ this.lastModifiedDelay = 1000;
}
/**
@@ -169,6 +172,8 @@
this.context = parent.context;
this.logKit = parent.logKit;
this.builderSelector = parent.builderSelector;
+ this.checkReload = parent.checkReload;
+ this.lastModifiedDelay = parent.lastModifiedDelay;
// We have our own CM
this.manager = manager;
@@ -189,10 +194,10 @@
Source source)
throws Exception {
+ // FIXME(VG): Why child isn't configure()d/contextualize(d)/etc ???
TreeProcessor child = new TreeProcessor(this, manager, language);
child.setLogger(getLogger());
- // FIXME : make delay configurable
- child.source = new DelayedRefreshSourceWrapper(source, 1000L);
+ child.source = new DelayedRefreshSourceWrapper(source, lastModifiedDelay);
return child;
}
@@ -309,7 +314,7 @@
try {
if (this.rootNode == null ||
- (this.checkReload == true && this.source.getLastModified() >
this.lastModified)) {
+ (this.checkReload && this.source.getLastModified() >
this.lastModified)) {
setupRootNode(environment);
}
return this.rootNode.invoke(environment, context);
@@ -345,13 +350,11 @@
}
if (this.source == null) {
- // FIXME : make the delay configurable
- this.source = new
DelayedRefreshSourceWrapper(env.resolve(this.fileName), 1000L);
+ this.source = new
DelayedRefreshSourceWrapper(env.resolve(this.fileName), lastModifiedDelay);
}
root = builder.build(this.source);
this.disposableNodes = builder.getDisposableNodes();
-
} finally {
this.builderSelector.release(builder);
}
@@ -361,7 +364,6 @@
if (getLogger().isDebugEnabled()) {
double time = (this.lastModified - startTime) / 1000.0;
getLogger().debug("TreeProcessor built in " + time + " secs from " +
source.getSystemId());
- //System.out.println("TreeProcessor built in " + time + " secs from " +
source.getSystemId());
}
// Finished
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]