You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by bl...@apache.org on 2001/02/22 16:03:10 UTC
cvs commit: xml-cocoon/src/org/apache/cocoon CocoonComponentSelector.java DefaultComponentManager.java
bloritsch 01/02/22 07:03:10
Modified: lib Tag: xml-cocoon2 avalonapi.jar
src/org/apache/cocoon Tag: xml-cocoon2
CocoonComponentSelector.java
DefaultComponentManager.java
Log:
Updated avalonapi with new ComponentManager/Selector release() methods.
Added handling code to Cocoon's release methods. Now, to release components
we get when we are done....
Revision Changes Path
No revision
No revision
1.1.2.16 +493 -442 xml-cocoon/lib/Attic/avalonapi.jar
<<Binary file>>
No revision
No revision
1.1.2.22 +16 -2 xml-cocoon/src/org/apache/cocoon/Attic/CocoonComponentSelector.java
Index: CocoonComponentSelector.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/CocoonComponentSelector.java,v
retrieving revision 1.1.2.21
retrieving revision 1.1.2.22
diff -u -r1.1.2.21 -r1.1.2.22
--- CocoonComponentSelector.java 2001/02/21 17:22:26 1.1.2.21
+++ CocoonComponentSelector.java 2001/02/22 15:03:09 1.1.2.22
@@ -19,6 +19,7 @@
import org.apache.avalon.ComponentManagerException;
import org.apache.avalon.ComponentNotFoundException;
import org.apache.avalon.ComponentNotAccessibleException;
+import org.apache.avalon.Recyclable;
import org.apache.avalon.Context;
import org.apache.avalon.Contextualizable;
import org.apache.avalon.Configurable;
@@ -42,7 +43,7 @@
/** Default component manager for Cocoon's non sitemap components.
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
* @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
- * @version CVS $Revision: 1.1.2.21 $ $Date: 2001/02/21 17:22:26 $
+ * @version CVS $Revision: 1.1.2.22 $ $Date: 2001/02/22 15:03:09 $
*/
public class CocoonComponentSelector implements Contextualizable, ComponentSelector, Composer, Configurable, ThreadSafe, Loggable {
protected Logger log;
@@ -238,7 +239,8 @@
e
);
}
- pools.put(hint,pool);
+
+ pools.put(componentClass, pool);
}
Component component;
@@ -254,6 +256,18 @@
}
return component;
+ }
+
+ public void release(Component component) {
+ if (component instanceof Poolable) {
+ ComponentPool pool = (ComponentPool) pools.get(component.getClass());
+
+ if (pool != null) {
+ pool.put((Poolable) component);
+ }
+ } else if (component instanceof Recyclable) {
+ ((Recyclable) component).recycle();
+ }
}
/** Configure a new component.
1.1.2.20 +15 -2 xml-cocoon/src/org/apache/cocoon/Attic/DefaultComponentManager.java
Index: DefaultComponentManager.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/DefaultComponentManager.java,v
retrieving revision 1.1.2.19
retrieving revision 1.1.2.20
diff -u -r1.1.2.19 -r1.1.2.20
--- DefaultComponentManager.java 2001/02/16 22:07:31 1.1.2.19
+++ DefaultComponentManager.java 2001/02/22 15:03:09 1.1.2.20
@@ -23,6 +23,7 @@
import org.apache.avalon.SingleThreaded;
import org.apache.avalon.ThreadSafe;
import org.apache.avalon.Poolable;
+import org.apache.avalon.Recyclable;
import org.apache.avalon.Configurable;
import org.apache.avalon.Configuration;
import org.apache.avalon.Composer;
@@ -40,7 +41,7 @@
/** Default component manager for Cocoon's non sitemap components.
* @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
- * @version CVS $Revision: 1.1.2.19 $ $Date: 2001/02/16 22:07:31 $
+ * @version CVS $Revision: 1.1.2.20 $ $Date: 2001/02/22 15:03:09 $
*/
public class DefaultComponentManager implements ComponentManager, Loggable, Configurable, Contextualizable {
@@ -276,7 +277,7 @@
e
);
}
- pools.put(componentClass,pool);
+ pools.put(componentClass, pool);
}
Component component;
@@ -292,6 +293,18 @@
}
return component;
+ }
+
+ public void release(Component component) {
+ if (component instanceof Poolable) {
+ ComponentPool pool = (ComponentPool) pools.get(component.getClass());
+
+ if (pool != null) {
+ pool.put((Poolable) component);
+ }
+ } else if (component instanceof Recyclable) {
+ ((Recyclable) component).recycle();
+ }
}
/** Configure a new component.
Re: cvs commit: xml-cocoon/src/org/apache/cocoon
CocoonComponentSelector.java DefaultComponentManager.java
Posted by Berin Loritsch <bl...@apache.org>.
Paul Russell wrote:
>
> * bloritsch@apache.org (bloritsch@apache.org) wrote :
> > bloritsch 01/02/22 07:03:10
> >
> > Modified: lib Tag: xml-cocoon2 avalonapi.jar
> > src/org/apache/cocoon Tag: xml-cocoon2
> > CocoonComponentSelector.java
> > DefaultComponentManager.java
> > Log:
> > Updated avalonapi with new ComponentManager/Selector release() methods.
> > Added handling code to Cocoon's release methods. Now, to release components
> > we get when we are done....
>
> We should be releasing _all_ components when we are done with them,
> right? (to provide full lifecycle management) This could be fun :)
Yep. That is the correct way to do it now. Once you no longer need the component,
you must release it--and not use it again. For Components with no end-of-life
lifecycle management, there is nothing to be done, but for others the clean-up
work is done in the ComponentManager/Selector
>
> Paul.
>
> --
> Paul Russell Email: paul@luminas.co.uk
> Technical Director Tel: +44 (0)20 8553 6622
> Luminas Internet Applications Fax: +44 (0)870 28 47489
> This is not an official statement or order. Web: www.luminas.co.uk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
Re: cvs commit: xml-cocoon/src/org/apache/cocoon CocoonComponentSelector.java DefaultComponentManager.java
Posted by Paul Russell <pa...@luminas.co.uk>.
* bloritsch@apache.org (bloritsch@apache.org) wrote :
> bloritsch 01/02/22 07:03:10
>
> Modified: lib Tag: xml-cocoon2 avalonapi.jar
> src/org/apache/cocoon Tag: xml-cocoon2
> CocoonComponentSelector.java
> DefaultComponentManager.java
> Log:
> Updated avalonapi with new ComponentManager/Selector release() methods.
> Added handling code to Cocoon's release methods. Now, to release components
> we get when we are done....
We should be releasing _all_ components when we are done with them,
right? (to provide full lifecycle management) This could be fun :)
Paul.
--
Paul Russell Email: paul@luminas.co.uk
Technical Director Tel: +44 (0)20 8553 6622
Luminas Internet Applications Fax: +44 (0)870 28 47489
This is not an official statement or order. Web: www.luminas.co.uk