You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2003/11/06 15:30:01 UTC
cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components ExtendedComponentSelector.java
cziegeler 2003/11/06 06:30:01
Modified: . status.xml
lib jars.xml
src/java/org/apache/cocoon/components
ExtendedComponentSelector.java
Added: lib/core excalibur-component-20031106.jar
Removed: lib/core excalibur-component-1.1.jar
Log:
Fixing threading problems in the ExtendedComponentSelector reported by Volker Schmitt
Revision Changes Path
1.183 +4 -1 cocoon-2.1/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/status.xml,v
retrieving revision 1.182
retrieving revision 1.183
diff -u -r1.182 -r1.183
--- status.xml 6 Nov 2003 09:01:35 -0000 1.182
+++ status.xml 6 Nov 2003 14:30:00 -0000 1.183
@@ -192,6 +192,9 @@
<changes>
<release version="@version@" date="@date@">
+ <action dev="CZ" type="fix" due-to="Volker Schmitt">
+ Fixing threading problems in the ExtendedComponentSelector.
+ </action>
<action dev="CZ" type="fix" fixes-bug="24409" due-to-email="holz@fiz-chemie.de" due-to="Martin Holz">
Fixing namespace handling in the send-mail transformer (Patch submitted by Martin Holz).
</action>
1.1 cocoon-2.1/lib/core/excalibur-component-20031106.jar
<<Binary file>>
1.120 +2 -2 cocoon-2.1/lib/jars.xml
Index: jars.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/lib/jars.xml,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -r1.119 -r1.120
--- jars.xml 4 Nov 2003 04:46:36 -0000 1.119
+++ jars.xml 6 Nov 2003 14:30:00 -0000 1.120
@@ -49,7 +49,7 @@
support high level server development.
</description>
<used-by>Cocoon</used-by>
- <lib>core/excalibur-component-1.1.jar</lib>
+ <lib>core/excalibur-component-20031106.jar</lib>
<homepage>http://avalon.apache.org/excalibur/</homepage>
</file>
1.6 +17 -11 cocoon-2.1/src/java/org/apache/cocoon/components/ExtendedComponentSelector.java
Index: ExtendedComponentSelector.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/ExtendedComponentSelector.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ExtendedComponentSelector.java 28 Oct 2003 19:53:57 -0000 1.5
+++ ExtendedComponentSelector.java 6 Nov 2003 14:30:01 -0000 1.6
@@ -78,7 +78,7 @@
protected RoleManager roles;
/** The parent selector, if any */
- protected ComponentSelector parentSelector;
+ protected ExtendedComponentSelector parentSelector;
/** The parent locator, if any */
protected ComponentLocator parentLocator;
@@ -86,9 +86,6 @@
/** The class loader to use */
protected ClassLoader classLoader;
- /** The components selected in the parent selector */
- protected Set parentComponents;
-
/** The role of this selector. Set in <code>configure()</code>. */
protected String roleName;
@@ -310,8 +307,7 @@
} catch(ComponentException ce) {
// Doesn't exist here : try in parent selector
- Component component = this.parentSelector.select(hint);
- this.parentComponents.add(component);
+ final Component component = this.parentSelector.select(hint);
return component;
}
}
@@ -319,7 +315,8 @@
public void release(Component component) {
// Was it selected on the parent ?
- if (this.parentComponents != null && this.parentComponents.remove(component)) {
+ if ( this.parentSelector != null &&
+ this.parentSelector.canRelease(component) ) {
this.parentSelector.release(component);
} else {
@@ -358,8 +355,7 @@
throw new ComponentException(null, "Parent selector is already set");
}
this.parentLocator = locator;
- this.parentSelector = (ComponentSelector) locator.lookup();
- this.parentComponents = new HashSet();
+ this.parentSelector = (ExtendedComponentSelector) locator.lookup();
}
/* (non-Javadoc)
@@ -371,8 +367,18 @@
this.parentLocator.release( this.parentSelector );
this.parentLocator = null;
this.parentSelector = null;
- this.parentComponents = null;
}
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.avalon.excalibur.component.ExcaliburComponentSelector#canRelease(org.apache.avalon.framework.component.Component)
+ */
+ protected boolean canRelease(Component component) {
+ if ( this.parentSelector != null &&
+ this.parentSelector.canRelease(component) ) {
+ return true;
+ }
+ return super.canRelease(component);
}
}