cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: cvs commit: xml-cocoon/src/org/apache/cocoon DefaultComponentManager.java CocoonComponentSelector.java
Date Sat, 03 Mar 2001 20:31:29 GMT
prussell@apache.org wrote:
>        public void release(Component component) {
>   +        if (component instanceof Disposable) {
>   +            try {
>   +                ((Disposable) component).dispose();
>   +            } catch (Exception e) {
>   +                this.log.warn(
>   +                    "Could not dispose of instance of component " + component.getClass().getName()
+ ".",
>   +                    e
>   +                );
>   +            }
>   +        }
>   +
>   +        if (component instanceof Recyclable) {
>   +            ((Recyclable) component).recycle();
>   +        }
>   +

WARNING! WARNING! WARNING!

The release() method is a Composer's way of stating that "I am done using this
Component".  It does NOT mean that the Component should be destroyed.  This
could cause dire issues with Components that are both ThreadSafe and Disposable.
When the ComponentManager/Selector is finally disposed, it should call those
End of Life events for the housed Components.

The exceptions to this are Poolable and SingleThreaded Components.  SingleThreaded
Components should be derived from the ComponentFactory (That's what it's there
for), and when they are returned, they should be decommissioned by the ComponentFactory.
When an object is Poolable, the Pool takes care of calling Recyclable, and preparing/
destroying the Components as they are returned.

If a Component is simply Recyclable, but not Poolable (I think this is impossible),
then we should explicitly call recycle().

This will cause a serious mess in a busy system--and possibly not so busy system.

Mime
View raw message