avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregory Steuck <greg-avalon-...@nest.cx>
Subject ECSelector infinite recursion
Date Thu, 09 May 2002 21:18:45 GMT
Hello,

is it a well known fact that if a ThreadSafe Component owned by an
ExcaliburComponentSelector tries to lookup it's containiner (selector
that is) in a lifecycle method (compose, initialize, start), then it
results in infinite recursion? Am I completely misusing it?

   <role shorthand="chained-selector"
         name="org.apache.avalon.excalibur.event.EventHandlerChainedSelector"
         default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">
      <hint shorthand="first-handler" class="test.PassingHandler"/>
      <hint shorthand="chained-handler" class="test.Handler1"/>
   </role>

  <components>
   <chained-selector>
     <first-handler name="test.PassingHandler"/>
     <chained-handler name="test.Handler1"/>
   </chained-selector>
  </components>


package test;

import org.apache.avalon.excalibur.event.QueueElement;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.excalibur.event.EventHandler;
import org.apache.avalon.framework.component.ComponentSelector;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.avalon.framework.activity.Startable;

public class PassingHandler
    extends AbstractSerialEventHandler
    implements Component, Composable, ThreadSafe, Startable
{
    private EventHandler m_handler;
    private ComponentSelector m_selector;
    private ComponentManager m_manager;

    public void handleEvent(QueueElement event) {
        AsyncHandlerSelectorTestCase.addResult(event, this.getClass());
        m_handler.handleEvent(event);
    }

    public void compose (ComponentManager manager)
        throws ComponentException
    {
        m_manager = manager;
    }

    public void start() throws Exception
    {
        m_selector =
            (ComponentSelector) m_manager.lookup(EventHandler.class.getName()+"ChainedSelector");
        m_handler =
            (EventHandler) m_selector.select(Handler1.class.getName());
    }


    public void stop() throws Exception
    {
        m_selector.release((Component) m_handler);
        m_manager.release(m_selector);
    }
}

at test.PassingHandler.start(PassingHandler.java:35)
at org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:212)
at org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:104)
at org.apache.avalon.excalibur.component.ExcaliburComponentSelector.addComponent(ExcaliburComponentSelector.java:505)
at org.apache.avalon.excalibur.component.ExcaliburComponentSelector.configure(ExcaliburComponentSelector.java:348)
at org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:191)
at org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:104)
at org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup(ExcaliburComponentManager.java:347)
at org.apache.avalon.excalibur.component.DefaultComponentFactory$ComponentManagerProxy.lookup(DefaultComponentFactory.java:319)
at org.apache.avalon.excalibur.component.DefaultComponentFactory$ComponentManagerProxy.lookup(DefaultComponentFactory.java:319)
at test.PassingHandler.start(PassingHandler.java:35)

--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message