bloritsch 01/12/28 09:59:35
Modified: src/org/apache/cocoon Cocoon.java
src/org/apache/cocoon/servlet CocoonServlet.java
Log:
clean up Cocoon dispose() code
Revision Changes Path
1.37 +8 -7 xml-cocoon2/src/org/apache/cocoon/Cocoon.java
Index: Cocoon.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Cocoon.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- Cocoon.java 2001/12/27 20:42:32 1.36
+++ Cocoon.java 2001/12/28 17:59:35 1.37
@@ -104,7 +104,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a> (Apache
Software Foundation, Exoffice Technologies)
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Leo Sutic</a>
- * @version CVS $Revision: 1.36 $ $Date: 2001/12/27 20:42:32 $
+ * @version CVS $Revision: 1.37 $ $Date: 2001/12/28 17:59:35 $
*/
public class Cocoon
extends AbstractLoggable
@@ -185,8 +185,8 @@
try {
this.configurationFile = new
URLSource((URL)context.get(Constants.CONTEXT_CONFIG_URL),
this.componentManager);
-
-
+
+
} catch (IOException ioe) {
getLogger().error("Could not open configuration file.", ioe);
throw new ContextException("Could not open configuration file.",
ioe);
@@ -208,8 +208,8 @@
}
/**
- * The <code>initialize</code> method
- *
+ * The <code>initialize</code> method
+ *
* @exception Exception if an error occurs
*/
public void initialize() throws Exception {
@@ -267,6 +267,7 @@
Configuration conf = this.configure(startupManager);
startupManager.dispose();
+ startupManager = null;
this.componentManager.initialize();
@@ -437,8 +438,8 @@
* @return a <code>boolean</code> value
*/
public boolean modifiedSince(long date) {
- this.configurationFile.refresh();
- return date < this.configurationFile.getLastModified();
+ this.configurationFile.refresh();
+ return date < this.configurationFile.getLastModified();
}
/**
1.58 +16 -13 xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java
Index: CocoonServlet.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- CocoonServlet.java 2001/12/20 15:15:36 1.57
+++ CocoonServlet.java 2001/12/28 17:59:35 1.58
@@ -62,7 +62,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Leo Sutic</a>
- * @version CVS $Revision: 1.57 $ $Date: 2001/12/20 15:15:36 $
+ * @version CVS $Revision: 1.58 $ $Date: 2001/12/28 17:59:35 $
*/
public class CocoonServlet extends HttpServlet {
@@ -315,8 +315,7 @@
if (log.isDebugEnabled()) {
log.debug("Servlet destroyed - disposing Cocoon");
}
- this.cocoon.dispose();
- this.cocoon = null;
+ this.disposeCocoon();
}
}
@@ -584,7 +583,7 @@
} catch (Exception e) {
Hierarchy.getDefaultHierarchy().log("Could not set up Cocoon Logger,
will use screen instead", e);
}
-
+
if (accesslogger != null) {
this.log = logKitManager.getLogger(accesslogger);
} else {
@@ -984,10 +983,7 @@
c.initialize();
this.creationTime = System.currentTimeMillis();
- if (this.cocoon != null) {
- this.cocoon.dispose();
- this.cocoon = null;
- }
+ this.disposeCocoon();
this.cocoon = c;
} catch (Exception e) {
@@ -996,11 +992,7 @@
}
this.exception = e;
- if (cocoon != null) {
- this.cocoon.dispose();
- }
-
- this.cocoon = null;
+ this.disposeCocoon();
}
}
@@ -1061,5 +1053,16 @@
}
return this.cocoon;
+ }
+
+ /**
+ * Destroy Cocoon
+ */
+ private final void disposeCocoon()
+ {
+ if (this.cocoon != null) {
+ this.cocoon.dispose();
+ this.cocoon = null;
+ }
}
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]