You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Thomas Torsney-Weir <TT...@Bear.com> on 2005/03/22 23:55:15 UTC

starting a component at startup

I'm using version 2.1.  I have created an avalon daemon component and 
set it up in cocoon.xconf with:
<component class="com.bear.hgscs.trading.daemon.RepoTradeVerifyDaemon" 
logger="core.repotrade" 
name="com.bear.hgscs.trading.daemon.RepoTradeVerifyDaemon">
   <parameter name="thread-pool-name" value="daemon"/>
</component>

I can get an instance of this from flowscript with 
cocoon.getComponent("com.bear.hgscs.trading.daemon.RepoTradeVerifyDaemon"). 
  This starts the daemon running.  However, I'd like this to 
automatically start when the servlet starts and stopped when the servlet 
ends.  The quartz scheduler from v2.1 seems to do this somehow, but I 
can't figure out how it works.  Does anyone know how to do this?

Thanks


***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation, 
offer or agreement or any information about any transaction, customer 
account or account activity contained in this communication.
***********************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: starting a component at startup

Posted by Jorg Heymans <jh...@domek.be>.
I don't know the intricacies of avalon daemon components (never used 
them), but can't you just add the necessary lifecycle interfaces to your 
avalon component? There are interfaces like Initializable etc that get 
called only once during the lifetime of a component.

Have a look at http://excalibur.apache.org/framework/lifecycle.html to 
see what i mean.

HTH
Jorg

Thomas Torsney-Weir wrote:
> I'm using version 2.1.  I have created an avalon daemon component and 
> set it up in cocoon.xconf with:
> <component class="com.bear.hgscs.trading.daemon.RepoTradeVerifyDaemon" 
> logger="core.repotrade" 
> name="com.bear.hgscs.trading.daemon.RepoTradeVerifyDaemon">
>   <parameter name="thread-pool-name" value="daemon"/>
> </component>
> 
> I can get an instance of this from flowscript with 
> cocoon.getComponent("com.bear.hgscs.trading.daemon.RepoTradeVerifyDaemon"). 
>  This starts the daemon running.  However, I'd like this to 
> automatically start when the servlet starts and stopped when the servlet 
> ends.  The quartz scheduler from v2.1 seems to do this somehow, but I 
> can't figure out how it works.  Does anyone know how to do this?
> 
> Thanks
> 
> 
> ***********************************************************************
> Bear Stearns is not responsible for any recommendation, solicitation, 
> offer or agreement or any information about any transaction, customer 
> account or account activity contained in this communication.
> ***********************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: starting a component at startup

Posted by Adam Walsh <aw...@contal.net.au>.
Thomas Torsney-Weir wrote:

> I'm using version 2.1.  I have created an avalon daemon component and 
> set it up in cocoon.xconf with:
> <component class="com.bear.hgscs.trading.daemon.RepoTradeVerifyDaemon" 
> logger="core.repotrade" 
> name="com.bear.hgscs.trading.daemon.RepoTradeVerifyDaemon">
>   <parameter name="thread-pool-name" value="daemon"/>
> </component>
>
> I can get an instance of this from flowscript with 
> cocoon.getComponent("com.bear.hgscs.trading.daemon.RepoTradeVerifyDaemon"). 
>  This starts the daemon running.  However, I'd like this to 
> automatically start when the servlet starts and stopped when the 
> servlet ends.  The quartz scheduler from v2.1 seems to do this 
> somehow, but I can't figure out how it works.  Does anyone know how to 
> do this?


Hi Thomas,

try having your avalon component implement ThreadSafe

Adam


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org