cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lachlan Paterson <lachlan.pater...@gmail.com>
Subject Re: More than one lifecycle interface
Date Tue, 18 Oct 2005 13:37:33 GMT
Ok, I got it:

My class is a generator so it was inheriting from AbstractGenerator which
inherits from AbstractXMLProducer which implements Recyclable, but I also
was implementing CacheableProcessingComponent on my own. I removed the
CacheableProcessingComponent stub code and then it was fine.

I had started writing this generator by looking at this example:
http://cocoon.zones.apache.org/daisy/documentation/writing/sitemapcomponents/688.html

which says to implement CacheableProcessingComponent. It seems that was
wrong.

This tutorial was a better place to start:
http://cocoon.apache.org/2.1/tutorial/tutorial-generator.html


On 10/18/05, Lachlan Paterson <lachlan.paterson@gmail.com> wrote:
>
> I should have been more clear. I know what the terms SingleThreaded,
> ThreadSafe, and Poolable mean. I was wondering more about the error itself.
>
> It is coming from:
> org.apache.avalon.excalibur.component.ComponentHandler.getComponentHandler
> (ComponentHandler.java:278)
>
> I was able to track down the source:
> http://www.devlib.org/apache/avalon/excalibur-component/source/
>
>
> The error is coming from this code:
>
>         int numInterfaces = 0;
>
>         if( SingleThreaded.class.isAssignableFrom( componentClass ) )
>         {
>             numInterfaces++;
>
>         }
>
>         if( ThreadSafe.class.isAssignableFrom( componentClass ) )
>         {
>             numInterfaces++;
>         }
>
>         if( Poolable.class.isAssignableFrom( componentClass ) )
>         {
>
>             numInterfaces++;
>         }
>
>         if( numInterfaces > 1 )
>         {
>             throw new Exception( "[CONFLICT] More than one lifecycle interface in "
>                                  +
> componentClass.getName() + "  May implement no more than one of "
>                                  + "SingleThreaded, ThreadSafe, or Poolable" );
>         }
>
> ...I'll have to dig deeper.
> -Lachlan
>
>
>
> On 10/18/05, Sylvain Wallez <sylvain@apache.org> wrote:
> >
> > Ralph Goers wrote:
> > > No, but it makes sense since they each have characterstics that are
> > > incompatible with each other.
> > > SingleThreaded implies that the class is a singleton and is not thread
> > > safe and should essentially be executed in a serial fashion (a huge
> > > bottleneck).
> >
> > SingleThreaded doesn't mean singleton! It means that the class is not
> > reentrant and not reusable, leading the system to create a new instance
> > each time the component is looked up. This is also the default for
> > component that implement no lifestyle interface.
> >
> > > ThreadSafe - the class is rentrant and can be executed by multiple
> > > threads simultaneously.
> >
> > And in this is a singleton, as only one instance is created and used for
> >
> > all requets.
> >
> > > Poolable - Each thread should get its own instance of the class and
> > > that there should be a pool of them from which they are doled out.
> >
> > Yup. Add to the picture Recyclable which extends Poolable for pooled
> > components that want to be notified that they are recycled, e.g. for
> > cleaning up their state.
> >
> > Sylvain
> >
> > --
> > Sylvain Wallez Anyware Technologies
> > http://people.apache.org/~sylvain <http://people.apache.org/%7Esylvain>
> > http://www.anyware-tech.com
> > Apache Software Foundation Member Research & Technology Director
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>

Mime
View raw message