vgritsenko 02/01/31 08:53:11 Modified: src/java/org/apache/cocoon/sitemap AbstractSitemap.java Handler.java Manager.java Log: Dispose all resources; fixes some reloading issues Revision Changes Path 1.5 +19 -10 xml-cocoon2/src/java/org/apache/cocoon/sitemap/AbstractSitemap.java Index: AbstractSitemap.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/sitemap/AbstractSitemap.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- AbstractSitemap.java 30 Jan 2002 10:14:48 -0000 1.4 +++ AbstractSitemap.java 31 Jan 2002 16:53:11 -0000 1.5 @@ -49,7 +49,7 @@ * Base class for generated <code>Sitemap</code> classes * * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> - * @version CVS $Revision: 1.4 $ $Date: 2002/01/30 10:14:48 $ + * @version CVS $Revision: 1.5 $ $Date: 2002/01/31 16:53:11 $ */ public abstract class AbstractSitemap extends AbstractLoggable implements Sitemap, Disposable, ThreadSafe { private Context context; @@ -430,18 +430,27 @@ if (this.selectors != null) { manager.release((Component)this.selectors); } + + this.urlFactory = null; + this.generators = null; + this.transformers = null; + this.serializers = null; + this.readers = null; + this.actions = null; + this.matchers = null; + this.selectors = null; + manager = null; } /** - Reset the response if possible. This allows error handlers to have - a higher chance to produce clean output if the pipeline that raised - the error has already output some data. - - @param objectModel the object model - @return true if the response was successfully reset - @deprecated Use the tryResetResponse on the Environment instead. - */ - + * Reset the response if possible. This allows error handlers to have + * a higher chance to produce clean output if the pipeline that raised + * the error has already output some data. + * + * @param objectModel the object model + * @return true if the response was successfully reset + * @deprecated Use the tryResetResponse on the Environment instead. + */ protected boolean tryResetResponse(Map objectModel) { getLogger().warn("tryResetResponse in AbstractSitemap is deprecated!"); 1.5 +24 -11 xml-cocoon2/src/java/org/apache/cocoon/sitemap/Handler.java Index: Handler.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/sitemap/Handler.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Handler.java 25 Jan 2002 03:49:57 -0000 1.4 +++ Handler.java 31 Jan 2002 16:53:11 -0000 1.5 @@ -42,7 +42,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> - * @version CVS $Revision: 1.4 $ $Date: 2002/01/25 03:49:57 $ + * @version CVS $Revision: 1.5 $ $Date: 2002/01/31 16:53:11 $ */ public class Handler extends AbstractLoggable implements Runnable, Contextualizable, Composable, Processor, Disposable, SourceResolver { @@ -80,7 +80,7 @@ sitemapCheckDelay = delay; } - public Handler() {} + public Handler() {} /** * Contextualizable @@ -98,15 +98,15 @@ this.sourceHandler = (SourceHandler)manager.lookup(SourceHandler.ROLE); } - public void setSourceFileName(String sourceFileName) - { - this.sourceFileName = sourceFileName; - } - - public void setCheckReload(boolean check_reload) - { - this.check_reload = check_reload; - } + public void setSourceFileName(String sourceFileName) + { + this.sourceFileName = sourceFileName; + } + + public void setCheckReload(boolean check_reload) + { + this.check_reload = check_reload; + } protected boolean available() { return (sitemap != null); @@ -274,10 +274,23 @@ this.source.recycle(); this.source = null; } + if (this.contextSource != null) { + this.contextSource.recycle(); + this.contextSource = null; + } if (this.sourceHandler != null) { manager.release((Component)this.sourceHandler); this.sourceHandler = null; } + + this.basePath = null; + this.sourceFileName = null; + this.exception = null; + this.sitemap = null; + this.check_reload = true; + this.regeneration = null; + this.isRegenerationRunning = false; + manager = null; } /** 1.4 +25 -7 xml-cocoon2/src/java/org/apache/cocoon/sitemap/Manager.java Index: Manager.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/sitemap/Manager.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Manager.java 25 Jan 2002 03:49:57 -0000 1.3 +++ Manager.java 31 Jan 2002 16:53:11 -0000 1.4 @@ -8,9 +8,7 @@ package org.apache.cocoon.sitemap; -import org.apache.avalon.excalibur.component.RoleManager; -import org.apache.avalon.excalibur.logger.LogKitManageable; -import org.apache.avalon.excalibur.logger.LogKitManager; +import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.component.Composable; @@ -22,6 +20,11 @@ import org.apache.avalon.framework.context.Contextualizable; import org.apache.avalon.framework.logger.AbstractLoggable; import org.apache.avalon.framework.thread.ThreadSafe; + +import org.apache.avalon.excalibur.component.RoleManager; +import org.apache.avalon.excalibur.logger.LogKitManageable; +import org.apache.avalon.excalibur.logger.LogKitManager; + import org.apache.cocoon.ProcessingException; import org.apache.cocoon.components.pipeline.EventPipeline; import org.apache.cocoon.components.pipeline.StreamPipeline; @@ -29,17 +32,19 @@ import java.util.HashMap; import java.util.Iterator; + /** * This class manages all sub <code>Sitemap</code>s of a <code>Sitemap</code> * Invokation of sub sitemaps will be done by this instance as well * checking regeneration of the sub <code>Sitemap</code> * * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> - * @version CVS $Revision: 1.3 $ $Date: 2002/01/25 03:49:57 $ + * @version CVS $Revision: 1.4 $ $Date: 2002/01/31 16:53:11 $ */ -public class Manager - extends AbstractLoggable - implements Component, Configurable, Composable, Contextualizable, ThreadSafe, LogKitManageable { +public class Manager extends AbstractLoggable + implements Component, Configurable, Composable, Contextualizable, + ThreadSafe, LogKitManageable, Disposable +{ protected Context context; /** The vectors of sub sitemaps */ @@ -247,5 +252,18 @@ "Please check logs for the exact error."); } } + } + + public void dispose() { + context = null; + for (Iterator i = sitemaps.values().iterator(); i.hasNext();) { + Handler sitemapHandler = (Handler)i.next(); + if (sitemapHandler != null) { + sitemapHandler.dispose(); + } + } + sitemaps.clear(); + conf = null; + manager = null; } }
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]